include/objacces.h
changeset 594 17a171fe7c56
parent 588 ee181b4f177b
child 629 b9274b595650
equal deleted inserted replaced
593:44702aa24113 594:17a171fe7c56
   118                    UNS32 * pExpectedSize,
   118                    UNS32 * pExpectedSize,
   119                    UNS8 * pDataType,
   119                    UNS8 * pDataType,
   120                    UNS8 checkAccess,
   120                    UNS8 checkAccess,
   121                    UNS8 endianize);
   121                    UNS8 endianize);
   122 
   122 
   123 
       
   124 /** 
   123 /** 
   125  * @ingroup od
   124  * @ingroup od
   126  * @brief getODentry() to read from object and endianize
   125  * @brief getODentry() to read from object and endianize
   127  * @param OD Pointer to a CAN object data structure
   126  * @param OD Pointer to a CAN object data structure
   128  * @param wIndex The index in the object dictionary where you want to read
   127  * @param wIndex The index in the object dictionary where you want to read
   140  * @param endianize  Set to 1 : endianized into network byte order 
   139  * @param endianize  Set to 1 : endianized into network byte order 
   141  * @return 
   140  * @return 
   142  * - OD_SUCCESSFUL is returned upon success. 
   141  * - OD_SUCCESSFUL is returned upon success. 
   143  * - SDO abort code is returned if error occurs . (See file def.h)
   142  * - SDO abort code is returned if error occurs . (See file def.h)
   144  */
   143  */
   145 UNS32 getODentry( CO_Data* d,
   144 #define getODentry( OD, wIndex, bSubindex, pDestData, pExpectedSize, \
   146                   UNS16 wIndex,
   145 		          pDataType,  checkAccess)                         \
   147                   UNS8 bSubindex,
   146        _getODentry( OD, wIndex, bSubindex, pDestData, pExpectedSize, \
   148                   void * pDestData,
   147 		          pDataType,  checkAccess, 1)            
   149                   UNS32 * pExpectedSize,
       
   150                   UNS8 * pDataType,
       
   151                   UNS8 checkAccess);
       
   152 
   148 
   153 /** 
   149 /** 
   154  * @ingroup od
   150  * @ingroup od
   155  * @brief readLocalDict() reads an entry from the object dictionary, but in 
   151  * @brief readLocalDict() reads an entry from the object dictionary, but in 
   156  * contrast to getODentry(), readLocalDict() doesn't endianize entry and reads
   152  * contrast to getODentry(), readLocalDict() doesn't endianize entry and reads
   173  *                  endianness 
   169  *                  endianness 
   174  * @return 
   170  * @return 
   175  * - OD_SUCCESSFUL is returned upon success. 
   171  * - OD_SUCCESSFUL is returned upon success. 
   176  * - SDO abort code is returned if error occurs . (See file def.h)
   172  * - SDO abort code is returned if error occurs . (See file def.h)
   177  */
   173  */
   178 UNS32 readLocalDict( CO_Data* d,
   174 #define readLocalDict( OD, wIndex, bSubindex, pDestData, pExpectedSize, \
   179                      UNS16 wIndex,
   175 		          pDataType,  checkAccess)                         \
   180                      UNS8 bSubindex,
   176        _getODentry( OD, wIndex, bSubindex, pDestData, pExpectedSize, \
   181                      void * pDestData,
   177 		          pDataType,  checkAccess, 0)
   182                      UNS32 * pExpectedSize,
       
   183                      UNS8 * pDataType,
       
   184                      UNS8 checkAccess);
       
   185 
   178 
   186 /* By this function you can write an entry into the object dictionary
   179 /* By this function you can write an entry into the object dictionary
   187  * @param *d Pointer to a CAN object data structure
   180  * @param *d Pointer to a CAN object data structure
   188  * @param wIndex The index in the object dictionary where you want to write
   181  * @param wIndex The index in the object dictionary where you want to write
   189  *               an entry
   182  *               an entry
   235  * @param endianize Set to 1 : endianized into network byte order
   228  * @param endianize Set to 1 : endianized into network byte order
   236  * @return 
   229  * @return 
   237  * - OD_SUCCESSFUL is returned upon success. 
   230  * - OD_SUCCESSFUL is returned upon success. 
   238  * - SDO abort code is returned if error occurs . (See file def.h)
   231  * - SDO abort code is returned if error occurs . (See file def.h)
   239  */
   232  */
   240 UNS32 setODentry( CO_Data* d,
   233 #define setODentry( d, wIndex, bSubindex, pSourceData, pExpectedSize, \
   241                    UNS16 wIndex,
   234                   checkAccess) \
   242                    UNS8 bSubindex,
   235        _setODentry( d, wIndex, bSubindex, pSourceData, pExpectedSize, \
   243                    void * pSourceData,
   236                   checkAccess, 1)
   244                    UNS32 * pExpectedSize,
       
   245                    UNS8 checkAccess);
       
   246 
   237 
   247 /** @fn UNS32 writeLocalDict(d, wIndex, bSubindex, pSourceData, pExpectedSize, checkAccess)
   238 /** @fn UNS32 writeLocalDict(d, wIndex, bSubindex, pSourceData, pExpectedSize, checkAccess)
   248  * @ingroup od
   239  * @ingroup od
   249  * @hideinitializer
   240  * @hideinitializer
   250  * @brief Writes machine native SourceData to OD.
   241  * @brief Writes machine native SourceData to OD.
   270  * B = 0xFF; // set transmission type
   261  * B = 0xFF; // set transmission type
   271  *
   262  *
   272  * retcode = writeLocalDict( (UNS16)0x1800, (UNS8)2, &B, sizeof(UNS8), 1 );
   263  * retcode = writeLocalDict( (UNS16)0x1800, (UNS8)2, &B, sizeof(UNS8), 1 );
   273  * @endcode
   264  * @endcode
   274  */
   265  */
   275 UNS32 writeLocalDict( CO_Data* d,
   266 #define writeLocalDict( d, wIndex, bSubindex, pSourceData, pExpectedSize, checkAccess) \
   276                       UNS16 wIndex,
   267        _setODentry( d, wIndex, bSubindex, pSourceData, pExpectedSize, checkAccess, 0)
   277                       UNS8 bSubindex,
   268 
   278                       void * pSourceData,
   269 
   279                       UNS32 * pExpectedSize,
   270 
   280                       UNS8 checkAccess);
       
   281 /**
   271 /**
   282  * @brief Scan the index of object dictionary. Used only by setODentry and getODentry.
   272  * @brief Scan the index of object dictionary. Used only by setODentry and getODentry.
   283  * @param *d Pointer to a CAN object data structure
   273  * @param *d Pointer to a CAN object data structure
   284  * @param wIndex
   274  * @param wIndex
   285  * @param *errorCode :  OD_SUCCESSFUL if index foundor SDO abort code. (See file def.h)
   275  * @param *errorCode :  OD_SUCCESSFUL if index foundor SDO abort code. (See file def.h)