examples/AppliMaster_HCS12/objdict.c
changeset 93 16c8ceea8f18
parent 92 0d84d95790d9
child 94 bdf4c86be6b2
equal deleted inserted replaced
92:0d84d95790d9 93:16c8ceea8f18
     1 /*
       
     2 This file is part of CanFestival, a library implementing CanOpen Stack. 
       
     3 
       
     4 Copyright (C): Edouard TISSERANT and Francis DUPIN
       
     5 
       
     6 See COPYING file for copyrights details.
       
     7 
       
     8 This library is free software; you can redistribute it and/or
       
     9 modify it under the terms of the GNU Lesser General Public
       
    10 License as published by the Free Software Foundation; either
       
    11 version 2.1 of the License, or (at your option) any later version.
       
    12 
       
    13 This library is distributed in the hope that it will be useful,
       
    14 but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    16 Lesser General Public License for more details.
       
    17 
       
    18 You should have received a copy of the GNU Lesser General Public
       
    19 License along with this library; if not, write to the Free Software
       
    20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
       
    21 */
       
    22 
       
    23 #include <stddef.h>
       
    24 
       
    25 #include <applicfg.h>
       
    26 #include "def.h"
       
    27 #include "can.h"
       
    28 #include "objdictdef.h"
       
    29 #include "pdo.h"
       
    30 #include "sdo.h"
       
    31 #include "sync.h"
       
    32 #include "lifegrd.h"
       
    33 #include "nmtSlave.h"
       
    34 
       
    35 /**************************************************************************/
       
    36 /* Declaration of the mapped variables                                    */
       
    37 /**************************************************************************/
       
    38 
       
    39 
       
    40 
       
    41 /*// Copy and uncomment this code to your main file
       
    42 extern UNS32 canopenErrNB_node5;		// Mapped at index 0x6000, subindex 0x00
       
    43 extern UNS32 canopenErrVAL_node5;		// Mapped at index 0x6001, subindex 0x00
       
    44 extern UNS8 second;		// Mapped at index 0x6002, subindex 0x01
       
    45 extern UNS8 minutes;		// Mapped at index 0x6002, subindex 0x02
       
    46 extern UNS8 hour;		// Mapped at index 0x6002, subindex 0x03
       
    47 extern UNS8 day;		// Mapped at index 0x6002, subindex 0x04
       
    48 extern UNS32 canopenErrNB;		// Mapped at index 0x6003, subindex 0x01
       
    49 extern UNS32 canopenErrVAL;		// Mapped at index 0x6003, subindex 0x02
       
    50 
       
    51 // END copy to main file
       
    52 */
       
    53 
       
    54 UNS32 canopenErrNB_node5;		// Mapped at index 0x6000, subindex 0x00
       
    55 UNS32 canopenErrVAL_node5;		// Mapped at index 0x6001, subindex 0x00
       
    56 UNS8 second;		// Mapped at index 0x6002, subindex 0x01
       
    57 UNS8 minutes;		// Mapped at index 0x6002, subindex 0x02
       
    58 UNS8 hour;		// Mapped at index 0x6002, subindex 0x03
       
    59 UNS8 day;		// Mapped at index 0x6002, subindex 0x04
       
    60 UNS32 canopenErrNB;		// Mapped at index 0x6003, subindex 0x01
       
    61 UNS32 canopenErrVAL;		// Mapped at index 0x6003, subindex 0x02
       
    62 
       
    63 /**************************************************************************/
       
    64 /* Declaration of the value range types                                   */
       
    65 /**************************************************************************/
       
    66 
       
    67 
       
    68 
       
    69 UNS32 valueRangeTest (UNS8 typeValue, UNS32 unsValue, REAL32 realValue)
       
    70 {
       
    71   return 0;
       
    72 }
       
    73 
       
    74 
       
    75 /**************************************************************************/
       
    76 /* The node id                                                            */
       
    77 /**************************************************************************/
       
    78 /* Computed by strNode */
       
    79 /* node_id default value. 
       
    80    This default value is deprecated.
       
    81    You should always overwrite this by using the function setNodeId(UNS8 nodeId) in your C code.
       
    82 */
       
    83 #define NODE_ID 0x01
       
    84 UNS8 bDeviceNodeId = NODE_ID;
       
    85 
       
    86 
       
    87 //*****************************************************************************/
       
    88 /* Computed by strStartDico */
       
    89 
       
    90 /* Array of message processing information */
       
    91 /* Should not be modified */
       
    92 volatile const proceed_info proceed_infos[] = {
       
    93   {NMT,		"NMT",	        NULL},
       
    94   {SYNC,        "SYNC",         proceedSYNC},
       
    95   {TIME_STAMP,	"TStmp",	NULL},
       
    96   {PDO1tx,	"PDO1t",        proceedPDO},
       
    97   {PDO1rx,	"PDO1r",	proceedPDO},
       
    98   {PDO2tx,	"PDO2t",	proceedPDO},
       
    99   {PDO2rx,	"PDO2r",	proceedPDO},
       
   100   {PDO3tx,	"PDO3t",	proceedPDO},
       
   101   {PDO3rx,	"PDO3r",	proceedPDO},
       
   102   {PDO4tx,	"PDO4t",	proceedPDO},
       
   103   {PDO4rx,	"PDO4r",	proceedPDO},
       
   104   {SDOtx,	"SDOt",	        proceedSDO},
       
   105   {SDOrx,	"SDOr",         proceedSDO},
       
   106   {0xD,		"Unkw",	        NULL},
       
   107   {NODE_GUARD,	"NGrd",         proceedNMTerror},
       
   108   {0xF,		"Unkw",	        NULL}
       
   109 };
       
   110 
       
   111   // Macros definition
       
   112 
       
   113 /* Beware : 
       
   114 index                 *must* be writen 4 numbers in hexa
       
   115 sub_index             *must* be writen 2 numbers in hexa
       
   116 size_variable_in_UNS8 *must* be writen 2 numbers in hexa
       
   117 */
       
   118 #define PDO_MAP(index, sub_index, size_variable_in_bits)\
       
   119 0x ## index ## sub_index ## size_variable_in_bits
       
   120 
       
   121 //$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
       
   122 //
       
   123 //                       OBJECT DICTIONARY
       
   124 //                   
       
   125 //$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
       
   126 // Make your change, depending of your application
       
   127  
       
   128 
       
   129 /* index 0x1000 :   Device type. 
       
   130                     You have to change the value below, so
       
   131                     it fits your canopen-slave-module */
       
   132  
       
   133                     /* Not used, so, should not be modified */
       
   134                     
       
   135                     UNS32 obj1000 = 0;
       
   136                     subindex Index1000[] =
       
   137                     {
       
   138                       { RO, uint32, sizeof(UNS32), (void*)&obj1000 }
       
   139                     };
       
   140 
       
   141 /* index 0x1001 :   Error register. 
       
   142                     Change the entries to fit your application 
       
   143                     Not used, so, should not be modified */
       
   144                     /*const*/ UNS8 obj1001 = 0x0;
       
   145                     /*const*/ subindex Index1001[] =
       
   146                     {
       
   147                       { RO, uint8, sizeof(UNS8), (void*)&obj1001 }
       
   148                     };
       
   149 
       
   150 /* index 0x1005 :   COB_ID SYNC */
       
   151                     /* Should not be modified */
       
   152                     UNS32 obj1005 = 0x00000080; // bit 30 = 1 : device can generate a SYNC message
       
   153                                                 // Beware, it is over written when the node 
       
   154                                                 // enters in reset mode
       
   155                                                 // See initResetMode() in init.c
       
   156                     /*const*/ subindex Index1005[] =
       
   157                     {
       
   158                       { RW, uint32, sizeof(UNS32), (void*)&obj1005 }
       
   159                     };
       
   160 
       
   161 /* index 0x1006 :   SYNC period */
       
   162                     // For producing the SYNC signal every n micro-seconds.
       
   163                     // Put O to not producing SYNC
       
   164                     /*const*/ UNS32 obj1006 = 0x0; 
       
   165                                          // Default 0 to not produce SYNC //
       
   166                                          // Beware, it is over written when the 
       
   167                                          // node enters in reset mode.
       
   168                                          // See initResetMode() in init.c
       
   169                     /*const*/ subindex Index1006[] =
       
   170                     {
       
   171                       { RW, uint32, sizeof(UNS32), (void*)&obj1006 }
       
   172                     };
       
   173  
       
   174 /* index 0x1007 :   Synchronous Window Length
       
   175                     Seems to be needed by DS401 to generate the SYNC signal ! */
       
   176                     /*const*/ UNS32 obj1007 = 0x0; /* Default 0 */
       
   177                     /*const*/ subindex Index1007[] =
       
   178                     {
       
   179                       { RW, uint32, sizeof(UNS32), (void*)&obj1007 }
       
   180                     };
       
   181 
       
   182 /* index 0x1008 :   Manufacturer device name */
       
   183                     UNS8 obj1008[] = "Appli_Master_HC12"; /* Default 0 */
       
   184                     subindex Index1008[] =
       
   185                     {
       
   186                       { RO, uint32, sizeof(obj1008), (void*)&obj1008 }
       
   187                     };
       
   188 
       
   189 /* index 0x1009 :   Manufacturer hardware version */
       
   190                     UNS8 obj1009[] = __DATE__; /* Default 0 */
       
   191                     subindex Index1009[] =
       
   192                     {
       
   193                       { RO, uint32, sizeof(obj1009), (void*)&obj1009 }
       
   194                     };
       
   195 
       
   196 /* index 0x100A :   Manufacturer software version */
       
   197                     UNS8 obj100A[] = __TIME__; /* Default 0 */
       
   198                     subindex Index100A[] =
       
   199                     {
       
   200                       { RO, uint32, sizeof(obj100A), (void*)&obj100A}
       
   201                     };
       
   202 
       
   203 /* index 0x1016 :   HeartBeat consumers 
       
   204                     The nodes which can send a heartbeat */ 
       
   205                     static  UNS32 obj1016[] = {// Consumer time for each node 
       
   206                     0x00000000}; // Format 0x00NNTTTT (N=Node T=time in ms)
       
   207 
       
   208                     static  UNS8 obj1016_cnt = 1; // 1 nodes could send me
       
   209                                                   // their heartbeat.
       
   210                     subindex Index1016[] = 
       
   211                     {
       
   212                       { RO, uint8, sizeof(UNS8), (void*)&obj1016_cnt },
       
   213                       { RW, uint32, sizeof(UNS32), (void*)&obj1016[0] }
       
   214                     }; 
       
   215 
       
   216 /* index 0x1017 :   Heartbeat producer                    
       
   217                     Every HBProducerTime, the node sends its heartbeat */
       
   218                     static UNS16 obj1017 = 0; //HBProducerTime in ms. If 0 : not activated 
       
   219                                                      // Beware, it is over written when the 
       
   220                                                      // node enters in reset mode.
       
   221                                                      // See initResetMode() in init.c
       
   222                     subindex Index1017[] =
       
   223                     {
       
   224 	              { RW, uint16, sizeof(UNS16), &obj1017 }
       
   225                     };
       
   226 
       
   227 /* index 0x1018 :   Identity object */
       
   228                     /** index 1018: identify object. Adjust the entries for your node/company
       
   229                     */
       
   230                     /* Values can be modified */
       
   231 
       
   232                     s_identity obj1018 =
       
   233                     {
       
   234                       4,       // number of supported entries
       
   235                       0,  // Vendor-ID (given by the can-cia)
       
   236                       0,  // Product Code
       
   237                       0,  // Revision number
       
   238                       0  // serial number
       
   239                     };
       
   240 
       
   241                     subindex Index1018[] =
       
   242                     {
       
   243                       { RO, uint8,  sizeof(UNS8),  (void*)&obj1018.count },
       
   244                       { RO, uint32, sizeof(UNS32), (void*)&obj1018.vendor_id},
       
   245                       { RO, uint32, sizeof(UNS32), (void*)&obj1018.product_code},
       
   246                       { RO, uint32, sizeof(UNS32), (void*)&obj1018.revision_number},
       
   247                       { RO, uint32, sizeof(UNS32), (void*)&obj1018.serial_number}
       
   248                     };
       
   249 
       
   250 /* index 0x1200 :   The SDO Server parameters */
       
   251                     /* BEWARE You cannot define more than one SDO server */
       
   252                     /* The values should not be modified here, 
       
   253                     but can be changed at runtime */
       
   254                     // Beware that the default values that you could put here
       
   255                     // will be over written at the initialisation of the node. 
       
   256                     // See setNodeId() in init.c
       
   257                     static s_sdo_parameter obj1200  = 
       
   258                       { 3,                   // Number of entries. Always 3 for the SDO	       
       
   259                         0x600 + NODE_ID,     // The cob_id transmited in CAN msg to the server     
       
   260                         0x580 + NODE_ID,     // The cob_id received in CAN msg from the server  
       
   261                         NODE_ID              // The node id of the client. Should not be modified 
       
   262                       };
       
   263                     static subindex Index1200[] =
       
   264                     {
       
   265                       { RO, uint8,  sizeof( UNS8 ), (void*)&obj1200.count },
       
   266                       { RO, uint32, sizeof( UNS32), (void*)&obj1200.cob_id_client },
       
   267                       { RO, uint32, sizeof( UNS32), (void*)&obj1200.cob_id_server },
       
   268                       { RW, uint8,  sizeof( UNS8),  (void*)&obj1200.node_id }
       
   269                     };
       
   270 
       
   271 /* index 0x1280 :   SDO client parameter */
       
   272                     static s_sdo_parameter obj1280 = 
       
   273                       { 3,     // Nb of entries 
       
   274                         0x600, // cobid transmited to the server. The good value should be 0x600 + server nodeId
       
   275                         0x580, // cobid received from the server. The good value should be 0x580 + server nodeId
       
   276                         0x0    // server NodeId
       
   277                       };
       
   278                     static subindex Index1280[] = 
       
   279                       { 
       
   280                         { RO, uint8, sizeof( UNS8  ), (void*)&obj1280.count },
       
   281                         { RW, uint8, sizeof( UNS32 ), (void*)&obj1280.cob_id_client },
       
   282                         { RW, uint8, sizeof( UNS32 ), (void*)&obj1280.cob_id_server },
       
   283                         { RW, uint8, sizeof( UNS8  ), (void*)&obj1280.node_id }
       
   284                       }; 
       
   285 
       
   286 /* index 0x1281 :   SDO client parameter */
       
   287                     static s_sdo_parameter obj1281 = 
       
   288                       { 3,     // Nb of entries 
       
   289                         0x600, // cobid transmited to the server. The good value should be 0x600 + server nodeId
       
   290                         0x580, // cobid received from the server. The good value should be 0x580 + server nodeId
       
   291                         0x0    // server NodeId
       
   292                       };
       
   293                     static subindex Index1281[] = 
       
   294                       { 
       
   295                         { RO, uint8, sizeof( UNS8  ), (void*)&obj1281.count },
       
   296                         { RW, uint8, sizeof( UNS32 ), (void*)&obj1281.cob_id_client },
       
   297                         { RW, uint8, sizeof( UNS32 ), (void*)&obj1281.cob_id_server },
       
   298                         { RW, uint8, sizeof( UNS8  ), (void*)&obj1281.node_id }
       
   299                       }; 
       
   300 
       
   301 /* index 0x1400 :   PDO receive communication parameter */
       
   302                     static s_pdo_communication_parameter obj1400 = 
       
   303                       { 2, // Largest subindex supported 
       
   304                         0x0, // Default COBID (overwritten at init for index 0x1400 to 0x1403)
       
   305                         253 // Transmission type. See objdictdef.h 
       
   306                       };
       
   307                     static subindex Index1400[] = 
       
   308                       { 
       
   309                         { RO, uint8, sizeof( UNS8  ), (void*)&obj1400.count },
       
   310                         { RW, uint8, sizeof( UNS32 ), (void*)&obj1400.cob_id },
       
   311                         { RW, uint8, sizeof( UNS8  ), (void*)&obj1400.type },
       
   312                       }; 
       
   313 
       
   314 /* index 0x1401 :   PDO receive communication parameter */
       
   315                     static s_pdo_communication_parameter obj1401 = 
       
   316                       { 2, // Largest subindex supported 
       
   317                         0x0, // Default COBID (overwritten at init for index 0x1400 to 0x1403)
       
   318                         253 // Transmission type. See objdictdef.h 
       
   319                       };
       
   320                     static subindex Index1401[] = 
       
   321                       { 
       
   322                         { RO, uint8, sizeof( UNS8  ), (void*)&obj1401.count },
       
   323                         { RW, uint8, sizeof( UNS32 ), (void*)&obj1401.cob_id },
       
   324                         { RW, uint8, sizeof( UNS8  ), (void*)&obj1401.type },
       
   325                       }; 
       
   326 
       
   327 /* index 0x1402 :   PDO receive communication parameter */
       
   328                     static s_pdo_communication_parameter obj1402 = 
       
   329                       { 2, // Largest subindex supported 
       
   330                         0x0, // Default COBID (overwritten at init for index 0x1400 to 0x1403)
       
   331                         253 // Transmission type. See objdictdef.h 
       
   332                       };
       
   333                     static subindex Index1402[] = 
       
   334                       { 
       
   335                         { RO, uint8, sizeof( UNS8  ), (void*)&obj1402.count },
       
   336                         { RW, uint8, sizeof( UNS32 ), (void*)&obj1402.cob_id },
       
   337                         { RW, uint8, sizeof( UNS8  ), (void*)&obj1402.type },
       
   338                       }; 
       
   339 
       
   340 /* index 0x1600 :   PDO receive mapping parameter of PDO communication index 0x1400 */
       
   341                     static UNS8 obj1600_cnt = 0; // Number of mapped variables
       
   342                     static UNS32 obj1600_mappedVar[] = { 
       
   343                         // Example to map a variable of 16 bits defined at index 0x6035, subindex 0x12 :
       
   344                         // PDO_MAP(6035,12,16)
       
   345                         PDO_MAP(0000, 00, 00),
       
   346                         PDO_MAP(0000, 00, 00),
       
   347                         PDO_MAP(0000, 00, 00),
       
   348                         PDO_MAP(0000, 00, 00),
       
   349                         PDO_MAP(0000, 00, 00),
       
   350                         PDO_MAP(0000, 00, 00),
       
   351                         PDO_MAP(0000, 00, 00),
       
   352                         PDO_MAP(0000, 00, 00)
       
   353                       };
       
   354                     subindex Index1600[] = 
       
   355                       { 
       
   356                         { RW, uint8, sizeof( UNS8  ), (void*)&obj1600_cnt },
       
   357                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1600_mappedVar[0]},
       
   358                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1600_mappedVar[1]},
       
   359                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1600_mappedVar[2]},
       
   360                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1600_mappedVar[3]},
       
   361                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1600_mappedVar[4]},
       
   362                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1600_mappedVar[5]},
       
   363                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1600_mappedVar[6]},
       
   364                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1600_mappedVar[7]}
       
   365                       }; 
       
   366 
       
   367 /* index 0x1601 :   PDO receive mapping parameter of PDO communication index 0x1401 */
       
   368                     static UNS8 obj1601_cnt = 0; // Number of mapped variables
       
   369                     static UNS32 obj1601_mappedVar[] = { 
       
   370                         // Example to map a variable of 16 bits defined at index 0x6035, subindex 0x12 :
       
   371                         // PDO_MAP(6035,12,16)
       
   372                         PDO_MAP(0000, 00, 00),
       
   373                         PDO_MAP(0000, 00, 00),
       
   374                         PDO_MAP(0000, 00, 00),
       
   375                         PDO_MAP(0000, 00, 00),
       
   376                         PDO_MAP(0000, 00, 00),
       
   377                         PDO_MAP(0000, 00, 00),
       
   378                         PDO_MAP(0000, 00, 00),
       
   379                         PDO_MAP(0000, 00, 00)
       
   380                       };
       
   381                     subindex Index1601[] = 
       
   382                       { 
       
   383                         { RW, uint8, sizeof( UNS8  ), (void*)&obj1601_cnt },
       
   384                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1601_mappedVar[0]},
       
   385                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1601_mappedVar[1]},
       
   386                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1601_mappedVar[2]},
       
   387                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1601_mappedVar[3]},
       
   388                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1601_mappedVar[4]},
       
   389                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1601_mappedVar[5]},
       
   390                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1601_mappedVar[6]},
       
   391                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1601_mappedVar[7]}
       
   392                       }; 
       
   393 
       
   394 /* index 0x1602 :   PDO receive mapping parameter of PDO communication index 0x1402 */
       
   395                     static UNS8 obj1602_cnt = 0; // Number of mapped variables
       
   396                     static UNS32 obj1602_mappedVar[] = { 
       
   397                         // Example to map a variable of 16 bits defined at index 0x6035, subindex 0x12 :
       
   398                         // PDO_MAP(6035,12,16)
       
   399                         PDO_MAP(0000, 00, 00),
       
   400                         PDO_MAP(0000, 00, 00),
       
   401                         PDO_MAP(0000, 00, 00),
       
   402                         PDO_MAP(0000, 00, 00),
       
   403                         PDO_MAP(0000, 00, 00),
       
   404                         PDO_MAP(0000, 00, 00),
       
   405                         PDO_MAP(0000, 00, 00),
       
   406                         PDO_MAP(0000, 00, 00)
       
   407                       };
       
   408                     subindex Index1602[] = 
       
   409                       { 
       
   410                         { RW, uint8, sizeof( UNS8  ), (void*)&obj1602_cnt },
       
   411                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1602_mappedVar[0]},
       
   412                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1602_mappedVar[1]},
       
   413                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1602_mappedVar[2]},
       
   414                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1602_mappedVar[3]},
       
   415                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1602_mappedVar[4]},
       
   416                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1602_mappedVar[5]},
       
   417                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1602_mappedVar[6]},
       
   418                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1602_mappedVar[7]}
       
   419                       }; 
       
   420 
       
   421 /* index 0x1800 :   PDO transmit communication parameter */
       
   422                     static s_pdo_communication_parameter obj1800 = 
       
   423                       { 2, // Largest subindex supported 
       
   424                         0x0, // Default COBID (overwritten at init for index 0x1400 to 0x1403)
       
   425                         253 // Transmission type. See objdictdef.h 
       
   426                       };
       
   427                     static subindex Index1800[] = 
       
   428                       { 
       
   429                         { RO, uint8, sizeof( UNS8  ), (void*)&obj1800.count },
       
   430                         { RW, uint8, sizeof( UNS32 ), (void*)&obj1800.cob_id },
       
   431                         { RW, uint8, sizeof( UNS8  ), (void*)&obj1800.type },
       
   432                       }; 
       
   433 
       
   434 /* index 0x1801 :   PDO transmit communication parameter */
       
   435                     static s_pdo_communication_parameter obj1801 = 
       
   436                       { 2, // Largest subindex supported 
       
   437                         0x0, // Default COBID (overwritten at init for index 0x1400 to 0x1403)
       
   438                         253 // Transmission type. See objdictdef.h 
       
   439                       };
       
   440                     static subindex Index1801[] = 
       
   441                       { 
       
   442                         { RO, uint8, sizeof( UNS8  ), (void*)&obj1801.count },
       
   443                         { RW, uint8, sizeof( UNS32 ), (void*)&obj1801.cob_id },
       
   444                         { RW, uint8, sizeof( UNS8  ), (void*)&obj1801.type },
       
   445                       }; 
       
   446 
       
   447 /* index 0x1802 :   PDO transmit communication parameter */
       
   448                     static s_pdo_communication_parameter obj1802 = 
       
   449                       { 2, // Largest subindex supported 
       
   450                         0x0, // Default COBID (overwritten at init for index 0x1400 to 0x1403)
       
   451                         253 // Transmission type. See objdictdef.h 
       
   452                       };
       
   453                     static subindex Index1802[] = 
       
   454                       { 
       
   455                         { RO, uint8, sizeof( UNS8  ), (void*)&obj1802.count },
       
   456                         { RW, uint8, sizeof( UNS32 ), (void*)&obj1802.cob_id },
       
   457                         { RW, uint8, sizeof( UNS8  ), (void*)&obj1802.type },
       
   458                       }; 
       
   459 
       
   460 /* index 0x1A00 :   PDO transmit mapping parameter of PDO communication index 0x1800 */
       
   461                     static UNS8 obj1A00_cnt = 0; // Number of mapped variables
       
   462                     static UNS32 obj1A00_mappedVar[] = { 
       
   463                         // Example to map a variable of 16 bits defined at index 0x6035, subindex 0x12 :
       
   464                         // PDO_MAP(6035,12,16)
       
   465                         PDO_MAP(0000, 00, 00),
       
   466                         PDO_MAP(0000, 00, 00),
       
   467                         PDO_MAP(0000, 00, 00),
       
   468                         PDO_MAP(0000, 00, 00),
       
   469                         PDO_MAP(0000, 00, 00),
       
   470                         PDO_MAP(0000, 00, 00),
       
   471                         PDO_MAP(0000, 00, 00),
       
   472                         PDO_MAP(0000, 00, 00)
       
   473                       };
       
   474                     subindex Index1A00[] = 
       
   475                       { 
       
   476                         { RW, uint8, sizeof( UNS8  ), (void*)&obj1A00_cnt },
       
   477                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1A00_mappedVar[0]},
       
   478                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1A00_mappedVar[1]},
       
   479                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1A00_mappedVar[2]},
       
   480                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1A00_mappedVar[3]},
       
   481                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1A00_mappedVar[4]},
       
   482                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1A00_mappedVar[5]},
       
   483                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1A00_mappedVar[6]},
       
   484                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1A00_mappedVar[7]}
       
   485                       }; 
       
   486 
       
   487 /* index 0x1A01 :   PDO transmit mapping parameter of PDO communication index 0x1801 */
       
   488                     static UNS8 obj1A01_cnt = 0; // Number of mapped variables
       
   489                     static UNS32 obj1A01_mappedVar[] = { 
       
   490                         // Example to map a variable of 16 bits defined at index 0x6035, subindex 0x12 :
       
   491                         // PDO_MAP(6035,12,16)
       
   492                         PDO_MAP(0000, 00, 00),
       
   493                         PDO_MAP(0000, 00, 00),
       
   494                         PDO_MAP(0000, 00, 00),
       
   495                         PDO_MAP(0000, 00, 00),
       
   496                         PDO_MAP(0000, 00, 00),
       
   497                         PDO_MAP(0000, 00, 00),
       
   498                         PDO_MAP(0000, 00, 00),
       
   499                         PDO_MAP(0000, 00, 00)
       
   500                       };
       
   501                     subindex Index1A01[] = 
       
   502                       { 
       
   503                         { RW, uint8, sizeof( UNS8  ), (void*)&obj1A01_cnt },
       
   504                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1A01_mappedVar[0]},
       
   505                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1A01_mappedVar[1]},
       
   506                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1A01_mappedVar[2]},
       
   507                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1A01_mappedVar[3]},
       
   508                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1A01_mappedVar[4]},
       
   509                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1A01_mappedVar[5]},
       
   510                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1A01_mappedVar[6]},
       
   511                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1A01_mappedVar[7]}
       
   512                       }; 
       
   513 
       
   514 /* index 0x1A02 :   PDO transmit mapping parameter of PDO communication index 0x1802 */
       
   515                     static UNS8 obj1A02_cnt = 0; // Number of mapped variables
       
   516                     static UNS32 obj1A02_mappedVar[] = { 
       
   517                         // Example to map a variable of 16 bits defined at index 0x6035, subindex 0x12 :
       
   518                         // PDO_MAP(6035,12,16)
       
   519                         PDO_MAP(0000, 00, 00),
       
   520                         PDO_MAP(0000, 00, 00),
       
   521                         PDO_MAP(0000, 00, 00),
       
   522                         PDO_MAP(0000, 00, 00),
       
   523                         PDO_MAP(0000, 00, 00),
       
   524                         PDO_MAP(0000, 00, 00),
       
   525                         PDO_MAP(0000, 00, 00),
       
   526                         PDO_MAP(0000, 00, 00)
       
   527                       };
       
   528                     subindex Index1A02[] = 
       
   529                       { 
       
   530                         { RW, uint8, sizeof( UNS8  ), (void*)&obj1A02_cnt },
       
   531                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1A02_mappedVar[0]},
       
   532                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1A02_mappedVar[1]},
       
   533                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1A02_mappedVar[2]},
       
   534                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1A02_mappedVar[3]},
       
   535                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1A02_mappedVar[4]},
       
   536                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1A02_mappedVar[5]},
       
   537                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1A02_mappedVar[6]},
       
   538                         { RW, uint32, sizeof( UNS32 ), (void*)&obj1A02_mappedVar[7]}
       
   539                       }; 
       
   540 
       
   541 
       
   542 /* index 0x6000 :   Mapped variable */
       
   543                     subindex Index6000[] = 
       
   544                      {
       
   545                        { RW, uint32, sizeof (UNS32), (void*)&canopenErrNB_node5 }
       
   546                      };
       
   547 
       
   548 /* index 0x6001 :   Mapped variable */
       
   549                     subindex Index6001[] = 
       
   550                      {
       
   551                        { RW, uint32, sizeof (UNS32), (void*)&canopenErrVAL_node5 }
       
   552                      };
       
   553 
       
   554 /* index 0x6002 :   Mapped variable */
       
   555                     static UNS8 highestSubIndex_6002 = 4; // number of subindex - 1
       
   556                     subindex Index6002[] = 
       
   557                      {
       
   558                        { RO, uint8, sizeof (UNS8), (void*)&highestSubIndex_6002 },
       
   559                        { RW, uint8, sizeof (UNS8), (void*)&second },
       
   560                        { RW, uint8, sizeof (UNS8), (void*)&minutes },
       
   561                        { RW, uint8, sizeof (UNS8), (void*)&hour },
       
   562                        { RW, uint8, sizeof (UNS8), (void*)&day }
       
   563                      };
       
   564 
       
   565 /* index 0x6003 :   Mapped variable */
       
   566                     static UNS8 highestSubIndex_6003 = 2; // number of subindex - 1
       
   567                     subindex Index6003[] = 
       
   568                      {
       
   569                        { RO, uint8, sizeof (UNS8), (void*)&highestSubIndex_6003 },
       
   570                        { RW, uint32, sizeof (UNS32), (void*)&canopenErrNB },
       
   571                        { RW, uint32, sizeof (UNS32), (void*)&canopenErrVAL }
       
   572                      };
       
   573 
       
   574 const indextable objdict[] = 
       
   575 {
       
   576   DeclareIndexTableEntry(Index1000, 0x1000),
       
   577   DeclareIndexTableEntry(Index1001, 0x1001),
       
   578   DeclareIndexTableEntry(Index1005, 0x1005),
       
   579   DeclareIndexTableEntry(Index1006, 0x1006),
       
   580   DeclareIndexTableEntry(Index1007, 0x1007),
       
   581   DeclareIndexTableEntry(Index1008, 0x1008),
       
   582   DeclareIndexTableEntry(Index1009, 0x1009),
       
   583   DeclareIndexTableEntry(Index100A, 0x100A),
       
   584   DeclareIndexTableEntry(Index1016, 0x1016),
       
   585   DeclareIndexTableEntry(Index1017, 0x1017),
       
   586   DeclareIndexTableEntry(Index1018, 0x1018),
       
   587   DeclareIndexTableEntry(Index1200, 0x1200),
       
   588   DeclareIndexTableEntry(Index1280, 0x1280),
       
   589   DeclareIndexTableEntry(Index1281, 0x1281),
       
   590   DeclareIndexTableEntry(Index1400, 0x1400),
       
   591   DeclareIndexTableEntry(Index1401, 0x1401),
       
   592   DeclareIndexTableEntry(Index1402, 0x1402),
       
   593   DeclareIndexTableEntry(Index1600, 0x1600),
       
   594   DeclareIndexTableEntry(Index1601, 0x1601),
       
   595   DeclareIndexTableEntry(Index1602, 0x1602),
       
   596   DeclareIndexTableEntry(Index1800, 0x1800),
       
   597   DeclareIndexTableEntry(Index1801, 0x1801),
       
   598   DeclareIndexTableEntry(Index1802, 0x1802),
       
   599   DeclareIndexTableEntry(Index1A00, 0x1A00),
       
   600   DeclareIndexTableEntry(Index1A01, 0x1A01),
       
   601   DeclareIndexTableEntry(Index1A02, 0x1A02),
       
   602   DeclareIndexTableEntry(Index6000, 0x6000),
       
   603   DeclareIndexTableEntry(Index6001, 0x6001),
       
   604   DeclareIndexTableEntry(Index6002, 0x6002),
       
   605   DeclareIndexTableEntry(Index6003, 0x6003),
       
   606 };
       
   607 
       
   608 // To count at which received SYNC a PDO must be sent.
       
   609 // Even if no pdoTransmit are defined, at least one entry is computed
       
   610 // for compilations issues.
       
   611 UNS8 count_sync[1] = {0, };
       
   612   
       
   613 UNS16 firstIndex (enum e_first_object object, UNS16 *lastIndex)
       
   614 {
       
   615   switch (object) {
       
   616     case FIRST_SDO_SERVER :
       
   617       *lastIndex = 11;
       
   618       return 11;
       
   619     case FIRST_SDO_CLIENT :
       
   620       *lastIndex = 13;
       
   621       return 12;
       
   622     case FIRST_PDO_RCV :
       
   623       *lastIndex = 16;
       
   624       return 14;
       
   625     case FIRST_PDO_RCV_MAP :
       
   626       *lastIndex = 19;
       
   627       return 17;
       
   628     case FIRST_PDO_TRS :
       
   629       *lastIndex = 22;
       
   630       return 20;
       
   631     case FIRST_PDO_TRS_MAP :
       
   632       *lastIndex = 25;
       
   633       return 23;
       
   634   }
       
   635   *lastIndex = 0;
       
   636   return 0;
       
   637 }
       
   638 
       
   639 UNS16 getObjdictSize (void) 
       
   640 {
       
   641   return sizeof(objdict)/sizeof(objdict[0]);
       
   642 }