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