examples/TestMasterSlave/TestSlave.c
author dejoigny
Wed, 17 May 2006 20:40:17 +0200
changeset 12 1d3b9ad366c8
parent 0 4472ee7c6c3e
child 23 6a5cdca4de01
permissions -rw-r--r--
CANOPEN_BIG_ENDIAN :
fonctionne pour SDO et PDO.
SDO segment?s test?s en upload et download. Semble ok.
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     1
/*
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     2
This file is part of CanFestival, a library implementing CanOpen Stack. 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     3
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     4
Copyright (C): Edouard TISSERANT and Francis DUPIN
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     5
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     6
See COPYING file for copyrights details.
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     7
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     8
This library is free software; you can redistribute it and/or
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     9
modify it under the terms of the GNU Lesser General Public
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    10
License as published by the Free Software Foundation; either
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    11
version 2.1 of the License, or (at your option) any later version.
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    12
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    13
This library is distributed in the hope that it will be useful,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    14
but WITHOUT ANY WARRANTY; without even the implied warranty of
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    16
Lesser General Public License for more details.
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    17
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    18
You should have received a copy of the GNU Lesser General Public
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    19
License along with this library; if not, write to the Free Software
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    20
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    21
*/
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    22
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    23
/* File generated by gen_cfile.py. Should not be modified. */
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    24
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    25
#include "TestSlave.h"
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    26
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    27
/**************************************************************************/
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    28
/* Declaration of the mapped variables                                    */
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    29
/**************************************************************************/
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    30
UNS8 SlaveMap1 = 0x0;		// Mapped at index 0x2000, subindex 0x00
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    31
UNS8 SlaveMap2 = 0x0;		// Mapped at index 0x2001, subindex 0x00
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    32
UNS8 SlaveMap3 = 0x0;		// Mapped at index 0x2002, subindex 0x00
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    33
UNS8 SlaveMap4 = 0x0;		// Mapped at index 0x2003, subindex 0x00
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    34
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    35
/**************************************************************************/
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    36
/* Declaration of the value range types                                   */
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    37
/**************************************************************************/
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    38
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    39
UNS32 TestSlave_valueRangeTest (UNS8 typeValue, void * value)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    40
{
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    41
  switch (typeValue) {
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    42
  }
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    43
  return 0;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    44
}
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    45
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    46
/**************************************************************************/
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    47
/* The node id                                                            */
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    48
/**************************************************************************/
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    49
/* node_id default value.*/
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    50
UNS8 TestSlave_bDeviceNodeId = 0x00;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    51
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    52
//*****************************************************************************/
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    53
/* Array of message processing information */
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    54
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    55
const UNS8 TestSlave_iam_a_slave = 1;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    56
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    57
TIMER_HANDLE TestSlave_heartBeatTimers[0];
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    58
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    59
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    60
//
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    61
//                       OBJECT DICTIONARY
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    62
//                   
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    63
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    64
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    65
/* index 0x1000 :   Device Type. */
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    66
                    UNS32 TestSlave_obj1000 = 0x12D;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    67
                    subindex TestSlave_Index1000[] = 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    68
                     {
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    69
                       { RO, uint32, sizeof (UNS32), (void*)&TestSlave_obj1000 }
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    70
                     };
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    71
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    72
/* index 0x1001 :   Error Register. */
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    73
                    UNS8 TestSlave_obj1001 = 0x0;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    74
                    subindex TestSlave_Index1001[] = 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    75
                     {
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    76
                       { RO, uint8, sizeof (UNS8), (void*)&TestSlave_obj1001 }
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    77
                     };
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    78
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    79
/* index 0x1005 :   SYNC COB ID. */
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    80
                    UNS32 TestSlave_obj1005 = 0x80;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    81
                    ODCallback_t TestSlave_Index1005_callbacks[] = 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    82
                     {
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    83
                       NULL,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    84
                     };
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    85
                    subindex TestSlave_Index1005[] = 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    86
                     {
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    87
                       { RW, uint32, sizeof (UNS32), (void*)&TestSlave_obj1005 }
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    88
                     };
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    89
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    90
/* index 0x1006 :   Communication / Cycle Period. */
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    91
                    UNS32 TestSlave_obj1006 = 0x0;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    92
                    ODCallback_t TestSlave_Index1006_callbacks[] = 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    93
                     {
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    94
                       NULL,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    95
                     };
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    96
                    subindex TestSlave_Index1006[] = 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    97
                     {
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    98
                       { RW, uint32, sizeof (UNS32), (void*)&TestSlave_obj1006 }
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    99
                     };
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   100
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   101
/* index 0x1016 :   Consumer Heartbeat Time */
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   102
                    UNS8 TestSlave_highestSubIndex_obj1016 = 0;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   103
                    UNS32 TestSlave_obj1016[0];
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   104
                    subindex TestSlave_Index1016[0];
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   105
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   106
/* index 0x1017 :   Producer Heartbeat Time. */
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   107
                    UNS16 TestSlave_obj1017 = 0x3E8;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   108
                    subindex TestSlave_Index1017[] = 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   109
                     {
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   110
                       { RW, uint16, sizeof (UNS16), (void*)&TestSlave_obj1017 }
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   111
                     };
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   112
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   113
/* index 0x1018 :   Identity. */
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   114
                    UNS8 TestSlave_highestSubIndex_obj1018 = 4; // number of subindex - 1
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   115
                    UNS32 TestSlave_obj1018_Vendor_ID = 0x0;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   116
                    UNS32 TestSlave_obj1018_Product_Code = 0x0;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   117
                    UNS32 TestSlave_obj1018_Revision_Number = 0x0;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   118
                    UNS32 TestSlave_obj1018_Serial_Number = 0x0;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   119
                    subindex TestSlave_Index1018[] = 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   120
                     {
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   121
                       { RO, uint8, sizeof (UNS8), (void*)&TestSlave_highestSubIndex_obj1018 },
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   122
                       { RO, uint32, sizeof (UNS32), (void*)&TestSlave_obj1018_Vendor_ID },
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   123
                       { RO, uint32, sizeof (UNS32), (void*)&TestSlave_obj1018_Product_Code },
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   124
                       { RO, uint32, sizeof (UNS32), (void*)&TestSlave_obj1018_Revision_Number },
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   125
                       { RO, uint32, sizeof (UNS32), (void*)&TestSlave_obj1018_Serial_Number }
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   126
                     };
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   127
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   128
/* index 0x1200 :   Server SDO Parameter. */
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   129
                    UNS8 TestSlave_highestSubIndex_obj1200 = 2; // number of subindex - 1
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   130
                    UNS32 TestSlave_obj1200_COB_ID_Client_to_Server_Receive_SDO = 0x601;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   131
                    UNS32 TestSlave_obj1200_COB_ID_Server_to_Client_Transmit_SDO = 0x581;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   132
                    subindex TestSlave_Index1200[] = 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   133
                     {
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   134
                       { RO, uint8, sizeof (UNS8), (void*)&TestSlave_highestSubIndex_obj1200 },
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   135
                       { RO, uint32, sizeof (UNS32), (void*)&TestSlave_obj1200_COB_ID_Client_to_Server_Receive_SDO },
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   136
                       { RO, uint32, sizeof (UNS32), (void*)&TestSlave_obj1200_COB_ID_Server_to_Client_Transmit_SDO }
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   137
                     };
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   138
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   139
/* index 0x1800 :   Transmit PDO 1 Parameter. */
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   140
                    UNS8 TestSlave_highestSubIndex_obj1800 = 5; // number of subindex - 1
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   141
                    UNS32 TestSlave_obj1800_COB_ID_used_by_PDO = 0x182;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   142
                    UNS8 TestSlave_obj1800_Transmission_Type = 0x1;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   143
                    UNS16 TestSlave_obj1800_Inhibit_Time = 0x0;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   144
                    UNS16 TestSlave_obj1800_Compatibility_Entry = 0x0;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   145
                    UNS16 TestSlave_obj1800_Event_Timer = 0x0;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   146
                    subindex TestSlave_Index1800[] = 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   147
                     {
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   148
                       { RO, uint8, sizeof (UNS8), (void*)&TestSlave_highestSubIndex_obj1800 },
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   149
                       { RW, uint32, sizeof (UNS32), (void*)&TestSlave_obj1800_COB_ID_used_by_PDO },
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   150
                       { RW, uint8, sizeof (UNS8), (void*)&TestSlave_obj1800_Transmission_Type },
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   151
                       { RW, uint16, sizeof (UNS16), (void*)&TestSlave_obj1800_Inhibit_Time },
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   152
                       { RW, uint16, sizeof (UNS16), (void*)&TestSlave_obj1800_Compatibility_Entry },
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   153
                       { RW, uint16, sizeof (UNS16), (void*)&TestSlave_obj1800_Event_Timer }
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   154
                     };
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   155
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   156
/* index 0x1801 :   Transmit PDO 2 Parameter. */
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   157
                    UNS8 TestSlave_highestSubIndex_obj1801 = 5; // number of subindex - 1
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   158
                    UNS32 TestSlave_obj1801_COB_ID_used_by_PDO = 0x282;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   159
                    UNS8 TestSlave_obj1801_Transmission_Type = 0x1;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   160
                    UNS16 TestSlave_obj1801_Inhibit_Time = 0x0;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   161
                    UNS16 TestSlave_obj1801_Compatibility_Entry = 0x0;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   162
                    UNS16 TestSlave_obj1801_Event_Timer = 0x0;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   163
                    subindex TestSlave_Index1801[] = 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   164
                     {
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   165
                       { RO, uint8, sizeof (UNS8), (void*)&TestSlave_highestSubIndex_obj1801 },
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   166
                       { RW, uint32, sizeof (UNS32), (void*)&TestSlave_obj1801_COB_ID_used_by_PDO },
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   167
                       { RW, uint8, sizeof (UNS8), (void*)&TestSlave_obj1801_Transmission_Type },
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   168
                       { RW, uint16, sizeof (UNS16), (void*)&TestSlave_obj1801_Inhibit_Time },
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   169
                       { RW, uint16, sizeof (UNS16), (void*)&TestSlave_obj1801_Compatibility_Entry },
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   170
                       { RW, uint16, sizeof (UNS16), (void*)&TestSlave_obj1801_Event_Timer }
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   171
                     };
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   172
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   173
/* index 0x1A00 :   Transmit PDO 1 Mapping. */
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   174
                    UNS8 TestSlave_highestSubIndex_obj1A00 = 2; // number of subindex - 1
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   175
                    UNS32 TestSlave_obj1A00[] = 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   176
                    {
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   177
                      536870920,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   178
                      536936456
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   179
                    };
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   180
                    subindex TestSlave_Index1A00[] = 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   181
                     {
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   182
                       { RO, uint8, sizeof (UNS8), (void*)&TestSlave_highestSubIndex_obj1A00 },
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   183
                       { RW, uint32, sizeof (UNS32), (void*)&TestSlave_obj1A00[0] },
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   184
                       { RW, uint32, sizeof (UNS32), (void*)&TestSlave_obj1A00[1] }
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   185
                     };
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   186
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   187
/* index 0x1A01 :   Transmit PDO 2 Mapping. */
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   188
                    UNS8 TestSlave_highestSubIndex_obj1A01 = 2; // number of subindex - 1
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   189
                    UNS32 TestSlave_obj1A01[] = 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   190
                    {
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   191
                      537001992,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   192
                      537067528
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   193
                    };
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   194
                    subindex TestSlave_Index1A01[] = 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   195
                     {
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   196
                       { RO, uint8, sizeof (UNS8), (void*)&TestSlave_highestSubIndex_obj1A01 },
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   197
                       { RW, uint32, sizeof (UNS32), (void*)&TestSlave_obj1A01[0] },
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   198
                       { RW, uint32, sizeof (UNS32), (void*)&TestSlave_obj1A01[1] }
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   199
                     };
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   200
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   201
/* index 0x2000 :   Mapped variable SlaveMap1 */
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   202
                    subindex TestSlave_Index2000[] = 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   203
                     {
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   204
                       { RW, uint8, sizeof (UNS8), (void*)&SlaveMap1 }
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   205
                     };
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   206
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   207
/* index 0x2001 :   Mapped variable SlaveMap2 */
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   208
                    subindex TestSlave_Index2001[] = 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   209
                     {
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   210
                       { RW, uint8, sizeof (UNS8), (void*)&SlaveMap2 }
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   211
                     };
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   212
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   213
/* index 0x2002 :   Mapped variable SlaveMap3 */
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   214
                    subindex TestSlave_Index2002[] = 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   215
                     {
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   216
                       { RW, uint8, sizeof (UNS8), (void*)&SlaveMap3 }
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   217
                     };
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   218
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   219
/* index 0x2003 :   Mapped variable SlaveMap4 */
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   220
                    subindex TestSlave_Index2003[] = 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   221
                     {
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   222
                       { RW, uint8, sizeof (UNS8), (void*)&SlaveMap4 }
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   223
                     };
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   224
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   225
const indextable TestSlave_objdict[] = 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   226
{
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   227
  { (subindex*)TestSlave_Index1000,sizeof(TestSlave_Index1000)/sizeof(TestSlave_Index1000[0]), 0x1000},
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   228
  { (subindex*)TestSlave_Index1001,sizeof(TestSlave_Index1001)/sizeof(TestSlave_Index1001[0]), 0x1001},
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   229
  { (subindex*)TestSlave_Index1005,sizeof(TestSlave_Index1005)/sizeof(TestSlave_Index1005[0]), 0x1005},
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   230
  { (subindex*)TestSlave_Index1006,sizeof(TestSlave_Index1006)/sizeof(TestSlave_Index1006[0]), 0x1006},
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   231
  { (subindex*)TestSlave_Index1017,sizeof(TestSlave_Index1017)/sizeof(TestSlave_Index1017[0]), 0x1017},
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   232
  { (subindex*)TestSlave_Index1018,sizeof(TestSlave_Index1018)/sizeof(TestSlave_Index1018[0]), 0x1018},
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   233
  { (subindex*)TestSlave_Index1200,sizeof(TestSlave_Index1200)/sizeof(TestSlave_Index1200[0]), 0x1200},
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   234
  { (subindex*)TestSlave_Index1800,sizeof(TestSlave_Index1800)/sizeof(TestSlave_Index1800[0]), 0x1800},
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   235
  { (subindex*)TestSlave_Index1801,sizeof(TestSlave_Index1801)/sizeof(TestSlave_Index1801[0]), 0x1801},
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   236
  { (subindex*)TestSlave_Index1A00,sizeof(TestSlave_Index1A00)/sizeof(TestSlave_Index1A00[0]), 0x1A00},
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   237
  { (subindex*)TestSlave_Index1A01,sizeof(TestSlave_Index1A01)/sizeof(TestSlave_Index1A01[0]), 0x1A01},
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   238
  { (subindex*)TestSlave_Index2000,sizeof(TestSlave_Index2000)/sizeof(TestSlave_Index2000[0]), 0x2000},
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   239
  { (subindex*)TestSlave_Index2001,sizeof(TestSlave_Index2001)/sizeof(TestSlave_Index2001[0]), 0x2001},
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   240
  { (subindex*)TestSlave_Index2002,sizeof(TestSlave_Index2002)/sizeof(TestSlave_Index2002[0]), 0x2002},
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   241
  { (subindex*)TestSlave_Index2003,sizeof(TestSlave_Index2003)/sizeof(TestSlave_Index2003[0]), 0x2003},
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   242
};
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   243
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   244
const indextable * TestSlave_scanIndexOD (UNS16 wIndex, UNS32 * errorCode, ODCallback_t **callbacks)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   245
{
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   246
	int i;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   247
	switch(wIndex){
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   248
		case 0x1000: i = 0; *callbacks = NULL; break;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   249
		case 0x1001: i = 1; *callbacks = NULL; break;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   250
		case 0x1005: i = 2; *callbacks = TestSlave_Index1005_callbacks; break;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   251
		case 0x1006: i = 3; *callbacks = TestSlave_Index1006_callbacks; break;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   252
		case 0x1017: i = 4; *callbacks = NULL; break;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   253
		case 0x1018: i = 5; *callbacks = NULL; break;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   254
		case 0x1200: i = 6; *callbacks = NULL; break;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   255
		case 0x1800: i = 7; *callbacks = NULL; break;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   256
		case 0x1801: i = 8; *callbacks = NULL; break;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   257
		case 0x1A00: i = 9; *callbacks = NULL; break;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   258
		case 0x1A01: i = 10; *callbacks = NULL; break;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   259
		case 0x2000: i = 11; *callbacks = NULL; break;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   260
		case 0x2001: i = 12; *callbacks = NULL; break;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   261
		case 0x2002: i = 13; *callbacks = NULL; break;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   262
		case 0x2003: i = 14; *callbacks = NULL; break;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   263
		default:
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   264
			*errorCode = OD_NO_SUCH_OBJECT;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   265
			return NULL;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   266
	}
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   267
	*errorCode = OD_SUCCESSFUL;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   268
	return &TestSlave_objdict[i];
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   269
}
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   270
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   271
// To count at which received SYNC a PDO must be sent.
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   272
// Even if no pdoTransmit are defined, at least one entry is computed
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   273
// for compilations issues.
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   274
UNS8 TestSlave_count_sync[2] = {0,};
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   275
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   276
quick_index TestSlave_firstIndex = {
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   277
  SDO_SVR : 6,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   278
  SDO_CLT : 0,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   279
  PDO_RCV : 0,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   280
  PDO_RCV_MAP : 0,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   281
  PDO_TRS : 7,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   282
  PDO_TRS_MAP : 9
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   283
};
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   284
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   285
quick_index TestSlave_lastIndex = {
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   286
  SDO_SVR : 6,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   287
  SDO_CLT : 0,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   288
  PDO_RCV : 0,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   289
  PDO_RCV_MAP : 0,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   290
  PDO_TRS : 8,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   291
  PDO_TRS_MAP : 10
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   292
};
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   293
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   294
UNS16 TestSlave_ObjdictSize = sizeof(TestSlave_objdict)/sizeof(TestSlave_objdict[0]); 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   295
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   296
CO_Data TestSlave_Data = CANOPEN_NODE_DATA_INITIALIZER(TestSlave);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   297