examples/TestMasterSlave/TestSlave.c
changeset 287 fa4df65d0683
parent 284 24bf3d692993
child 307 230d55cb75a4
equal deleted inserted replaced
286:85d5361179f3 287:fa4df65d0683
    22 
    22 
    23 /**************************************************************************/
    23 /**************************************************************************/
    24 /* Declaration of the value range types                                   */
    24 /* Declaration of the value range types                                   */
    25 /**************************************************************************/
    25 /**************************************************************************/
    26 
    26 
       
    27 #define valueRange_EMC 0x9F /* Type for index 0x1003 subindex 0x00 (only set of value 0 is possible) */
    27 UNS32 TestSlave_valueRangeTest (UNS8 typeValue, void * value)
    28 UNS32 TestSlave_valueRangeTest (UNS8 typeValue, void * value)
    28 {
    29 {
    29   switch (typeValue) {
    30   switch (typeValue) {
       
    31     case valueRange_EMC:
       
    32       if (*(UNS8*)value < (UNS8)0) return OD_VALUE_TOO_LOW;
       
    33       if (*(UNS8*)value > (UNS8)0) return OD_VALUE_TOO_HIGH;
       
    34       break;
    30   }
    35   }
    31   return 0;
    36   return 0;
    32 }
    37 }
    33 
    38 
    34 /**************************************************************************/
    39 /**************************************************************************/
    65                      {
    70                      {
    66                        { RO, uint8, sizeof (UNS8), (void*)&TestSlave_obj1001 }
    71                        { RO, uint8, sizeof (UNS8), (void*)&TestSlave_obj1001 }
    67                      };
    72                      };
    68 
    73 
    69 /* index 0x1003 :   Pre-defined Error Field. */
    74 /* index 0x1003 :   Pre-defined Error Field. */
    70                     UNS8 TestSlave_highestSubIndex_obj1003 = 8; /* number of subindex - 1*/
    75                     UNS8 TestSlave_highestSubIndex_obj1003 = 0; /* number of subindex - 1*/
    71                     UNS32 TestSlave_obj1003[] = 
    76                     UNS32 TestSlave_obj1003[] = 
    72                     {
    77                     {
    73                       0x0,	/* 0 */
    78                       0x0,	/* 0 */
    74                       0x0,	/* 0 */
    79                       0x0,	/* 0 */
    75                       0x0,	/* 0 */
    80                       0x0,	/* 0 */
    91                        NULL,
    96                        NULL,
    92                        NULL,
    97                        NULL,
    93                      };
    98                      };
    94                     subindex TestSlave_Index1003[] = 
    99                     subindex TestSlave_Index1003[] = 
    95                      {
   100                      {
    96                        { RW, uint8, sizeof (UNS8), (void*)&TestSlave_highestSubIndex_obj1003 },
   101                        { RW, valueRange_EMC, sizeof (UNS8), (void*)&TestSlave_highestSubIndex_obj1003 },
    97                        { RO, uint32, sizeof (UNS32), (void*)&TestSlave_obj1003[0] },
   102                        { RO, uint32, sizeof (UNS32), (void*)&TestSlave_obj1003[0] },
    98                        { RO, uint32, sizeof (UNS32), (void*)&TestSlave_obj1003[1] },
   103                        { RO, uint32, sizeof (UNS32), (void*)&TestSlave_obj1003[1] },
    99                        { RO, uint32, sizeof (UNS32), (void*)&TestSlave_obj1003[2] },
   104                        { RO, uint32, sizeof (UNS32), (void*)&TestSlave_obj1003[2] },
   100                        { RO, uint32, sizeof (UNS32), (void*)&TestSlave_obj1003[3] },
   105                        { RO, uint32, sizeof (UNS32), (void*)&TestSlave_obj1003[3] },
   101                        { RO, uint32, sizeof (UNS32), (void*)&TestSlave_obj1003[4] },
   106                        { RO, uint32, sizeof (UNS32), (void*)&TestSlave_obj1003[4] },