include/objacces.h
changeset 469 f2b07ea215b5
parent 378 d2abf6c8c27b
child 528 0a30e161d63c
equal deleted inserted replaced
468:787a54d068d6 469:f2b07ea215b5
    57 
    57 
    58 UNS8 accessDictionaryError(UNS16 index, UNS8 subIndex, 
    58 UNS8 accessDictionaryError(UNS16 index, UNS8 subIndex, 
    59 			   UNS8 sizeDataDict, UNS8 sizeDataGiven, UNS32 code);
    59 			   UNS8 sizeDataDict, UNS8 sizeDataGiven, UNS32 code);
    60 
    60 
    61 
    61 
    62 /* Reads an entry from the object dictionary.\n
    62 /* _getODentry() Reads an entry from the object dictionary.\n
       
    63  * 
       
    64  *    use getODentry() macro to read from object and endianize
       
    65  *    use readLocalDict() macro to read from object and not endianize   
       
    66  *
    63  *  \code
    67  *  \code
    64  *  // Example usage:
    68  *  // Example usage:
    65  *  UNS8  *pbData;
    69  *  UNS8  *pbData;
    66  *  UNS8 length;
    70  *  UNS8 length;
    67  *  UNS32 returnValue;
    71  *  UNS32 returnValue;
    84  *  \param pdwSize This function writes the size of the copied value (in Byte)
    88  *  \param pdwSize This function writes the size of the copied value (in Byte)
    85  *                 into this variable.
    89  *                 into this variable.
    86  *  \param pDataType : The type of the data. See objdictdef.h
    90  *  \param pDataType : The type of the data. See objdictdef.h
    87  *  \param CheckAccess if other than 0, do not read if the data is Write Only
    91  *  \param CheckAccess if other than 0, do not read if the data is Write Only
    88  *                     [Not used today. Put always 0].
    92  *                     [Not used today. Put always 0].
       
    93  *  \param Endianize  when not 0, data is endianized into network byte order
       
    94  *                    when 0, data is not endianized and copied in machine native
       
    95  *                    endianness 
    89  *  \return OD_SUCCESSFUL or SDO abort code. (See file def.h)
    96  *  \return OD_SUCCESSFUL or SDO abort code. (See file def.h)
    90  */
    97  */
    91 UNS32 getODentry( CO_Data* d, 
    98 UNS32 _getODentry( CO_Data* d, 
    92                   UNS16 wIndex,
    99 		  UNS16 wIndex,
    93 		  UNS8 bSubindex,
   100 		  UNS8 bSubindex,
    94 		  void * pDestData,
   101 		  void * pDestData,
    95 		  UNS8 * pExpectedSize,
   102 		  UNS8 * pExpectedSize,
    96 		  UNS8 * pDataType,
   103 		  UNS8 * pDataType,
    97 		  UNS8 checkAccess);
   104 		  UNS8 checkAccess,
       
   105 		  UNS8 endianize);
    98 
   106 
       
   107 #define getODentry( OD, wIndex, bSubindex, pDestData, pExpectedSize, \
       
   108 		          pDataType,  checkAccess)                         \
       
   109        _getODentry( OD, wIndex, bSubindex, pDestData, pExpectedSize, \
       
   110 		          pDataType,  checkAccess, 1)            
       
   111 
       
   112 /*
       
   113  * readLocalDict() reads an entry from the object dictionary, but in 
       
   114  * contrast to getODentry(), readLocalDict() doesn't endianize entry and reads
       
   115  * entry in machine native endianness.
       
   116  */
       
   117 #define readLocalDict( OD, wIndex, bSubindex, pDestData, pExpectedSize, \
       
   118 		          pDataType,  checkAccess)                         \
       
   119        _getODentry( OD, wIndex, bSubindex, pDestData, pExpectedSize, \
       
   120 		          pDataType,  checkAccess, 0)
    99 
   121 
   100 /* By this function you can write an entry into the object dictionary\n
   122 /* By this function you can write an entry into the object dictionary\n
   101  *  \code
   123  *  \code
   102  *  // Example usage:
   124  *  // Example usage:
   103  *  UNS8 B;
   125  *  UNS8 B;
   115  *                 be copied into the object dictionary
   137  *                 be copied into the object dictionary
   116  *  \param dwSize The size of the value (in Byte).
   138  *  \param dwSize The size of the value (in Byte).
   117  *  \param CheckAccess if other than 0, do not read if the data is Read Only or Constant
   139  *  \param CheckAccess if other than 0, do not read if the data is Read Only or Constant
   118  *  \return OD_SUCCESSFUL or SDO abort code. (See file def.h)
   140  *  \return OD_SUCCESSFUL or SDO abort code. (See file def.h)
   119  */
   141  */
   120 UNS32 setODentry( CO_Data* d, 
   142 UNS32 _setODentry( CO_Data* d,
   121                   UNS16 wIndex,
   143                    UNS16 wIndex,
   122 		  UNS8 bSubindex, 
   144                    UNS8 bSubindex,
   123 		  void * pSourceData, 
   145                    void * pSourceData,
   124 		  UNS8 * pExpectedSize, 
   146                    UNS8 * pExpectedSize,
   125 		  UNS8 checkAccess);
   147                    UNS8 checkAccess,
       
   148                    UNS8 endianize);
   126 
   149 
   127 /*The same, without endianisation*/
   150 /*
   128 UNS32 writeLocalDict( CO_Data* d, 
   151  * setODentry converts SourceData from network byte order to machine native 
   129                   UNS16 wIndex,
   152  *            format, and writes that to OD.
   130 		  UNS8 bSubindex, 
   153  */
   131 		  void * pSourceData, 
   154 #define setODentry( d, wIndex, bSubindex, pSourceData, pExpectedSize, checkAccess) \
   132 		  UNS8 * pExpectedSize, 
   155        _setODentry( d, wIndex, bSubindex, pSourceData, pExpectedSize, checkAccess, 1)
   133 		  UNS8 checkAccess);
   156 
       
   157 /*
       
   158  * writeLocalDict writes machine native SourceData to OD.
       
   159  */
       
   160 #define writeLocalDict( d, wIndex, bSubindex, pSourceData, pExpectedSize, checkAccess) \
       
   161        _setODentry( d, wIndex, bSubindex, pSourceData, pExpectedSize, checkAccess, 0)
       
   162 
   134 
   163 
   135 
   164 
   136 /* Scan the index of object dictionary. Used only by setODentry and getODentry.
   165 /* Scan the index of object dictionary. Used only by setODentry and getODentry.
   137  *  *errorCode :  OD_SUCCESSFUL if index foundor SDO abort code. (See file def.h)
   166  *  *errorCode :  OD_SUCCESSFUL if index foundor SDO abort code. (See file def.h)
   138  *  Return NULL if index not found. Else : return the table part of the object dictionary.
   167  *  Return NULL if index not found. Else : return the table part of the object dictionary.