include/objacces.h
changeset 588 ee181b4f177b
parent 561 f9be4262c68d
child 594 17a171fe7c56
equal deleted inserted replaced
587:c175351a6994 588:ee181b4f177b
    38  
    38  
    39 #ifndef __objacces_h__
    39 #ifndef __objacces_h__
    40 #define __objacces_h__
    40 #define __objacces_h__
    41 
    41 
    42 #include <applicfg.h>
    42 #include <applicfg.h>
       
    43 
       
    44 
       
    45 #ifdef __cplusplus
       
    46 extern "C" {
       
    47 #endif
       
    48 
    43 
    49 
    44 typedef UNS32 (*valueRangeTest_t)(UNS8 typeValue, void *Value);
    50 typedef UNS32 (*valueRangeTest_t)(UNS8 typeValue, void *Value);
    45 typedef void (* storeODSubIndex_t)(CO_Data* d, UNS16 wIndex, UNS8 bSubindex);
    51 typedef void (* storeODSubIndex_t)(CO_Data* d, UNS16 wIndex, UNS8 bSubindex);
    46 void _storeODSubIndex (CO_Data* d, UNS16 wIndex, UNS8 bSubindex);
    52 void _storeODSubIndex (CO_Data* d, UNS16 wIndex, UNS8 bSubindex);
    47 
    53 
   103  *                   endianness 
   109  *                   endianness 
   104  * @return 
   110  * @return 
   105  * - OD_SUCCESSFUL is returned upon success. 
   111  * - OD_SUCCESSFUL is returned upon success. 
   106  * - SDO abort code is returned if error occurs . (See file def.h)
   112  * - SDO abort code is returned if error occurs . (See file def.h)
   107  */
   113  */
   108 UNS32 _getODentry( CO_Data* d, 
   114 UNS32 _getODentry( CO_Data* d,
   109 		  UNS16 wIndex,
   115                    UNS16 wIndex,
   110 		  UNS8 bSubindex,
   116                    UNS8 bSubindex,
   111 		  void * pDestData,
   117                    void * pDestData,
   112 		  UNS32 * pExpectedSize,
   118                    UNS32 * pExpectedSize,
   113 		  UNS8 * pDataType,
   119                    UNS8 * pDataType,
   114 		  UNS8 checkAccess,
   120                    UNS8 checkAccess,
   115 		  UNS8 endianize);
   121                    UNS8 endianize);
       
   122 
   116 
   123 
   117 /** 
   124 /** 
   118  * @ingroup od
   125  * @ingroup od
   119  * @brief getODentry() to read from object and endianize
   126  * @brief getODentry() to read from object and endianize
   120  * @param OD Pointer to a CAN object data structure
   127  * @param OD Pointer to a CAN object data structure
   133  * @param endianize  Set to 1 : endianized into network byte order 
   140  * @param endianize  Set to 1 : endianized into network byte order 
   134  * @return 
   141  * @return 
   135  * - OD_SUCCESSFUL is returned upon success. 
   142  * - OD_SUCCESSFUL is returned upon success. 
   136  * - SDO abort code is returned if error occurs . (See file def.h)
   143  * - SDO abort code is returned if error occurs . (See file def.h)
   137  */
   144  */
   138 #define getODentry( OD, wIndex, bSubindex, pDestData, pExpectedSize, \
   145 UNS32 getODentry( CO_Data* d,
   139 		          pDataType,  checkAccess)                         \
   146                   UNS16 wIndex,
   140        _getODentry( OD, wIndex, bSubindex, pDestData, pExpectedSize, \
   147                   UNS8 bSubindex,
   141 		          pDataType,  checkAccess, 1)            
   148                   void * pDestData,
       
   149                   UNS32 * pExpectedSize,
       
   150                   UNS8 * pDataType,
       
   151                   UNS8 checkAccess);
   142 
   152 
   143 /** 
   153 /** 
   144  * @ingroup od
   154  * @ingroup od
   145  * @brief readLocalDict() reads an entry from the object dictionary, but in 
   155  * @brief readLocalDict() reads an entry from the object dictionary, but in 
   146  * contrast to getODentry(), readLocalDict() doesn't endianize entry and reads
   156  * contrast to getODentry(), readLocalDict() doesn't endianize entry and reads
   163  *                  endianness 
   173  *                  endianness 
   164  * @return 
   174  * @return 
   165  * - OD_SUCCESSFUL is returned upon success. 
   175  * - OD_SUCCESSFUL is returned upon success. 
   166  * - SDO abort code is returned if error occurs . (See file def.h)
   176  * - SDO abort code is returned if error occurs . (See file def.h)
   167  */
   177  */
   168 #define readLocalDict( OD, wIndex, bSubindex, pDestData, pExpectedSize, \
   178 UNS32 readLocalDict( CO_Data* d,
   169 		          pDataType,  checkAccess)                         \
   179                      UNS16 wIndex,
   170        _getODentry( OD, wIndex, bSubindex, pDestData, pExpectedSize, \
   180                      UNS8 bSubindex,
   171 		          pDataType,  checkAccess, 0)
   181                      void * pDestData,
       
   182                      UNS32 * pExpectedSize,
       
   183                      UNS8 * pDataType,
       
   184                      UNS8 checkAccess);
   172 
   185 
   173 /* By this function you can write an entry into the object dictionary
   186 /* By this function you can write an entry into the object dictionary
   174  * @param *d Pointer to a CAN object data structure
   187  * @param *d Pointer to a CAN object data structure
   175  * @param wIndex The index in the object dictionary where you want to write
   188  * @param wIndex The index in the object dictionary where you want to write
   176  *               an entry
   189  *               an entry
   222  * @param endianize Set to 1 : endianized into network byte order
   235  * @param endianize Set to 1 : endianized into network byte order
   223  * @return 
   236  * @return 
   224  * - OD_SUCCESSFUL is returned upon success. 
   237  * - OD_SUCCESSFUL is returned upon success. 
   225  * - SDO abort code is returned if error occurs . (See file def.h)
   238  * - SDO abort code is returned if error occurs . (See file def.h)
   226  */
   239  */
   227 #define setODentry( d, wIndex, bSubindex, pSourceData, pExpectedSize, \
   240 UNS32 setODentry( CO_Data* d,
   228                   checkAccess) \
   241                    UNS16 wIndex,
   229        _setODentry( d, wIndex, bSubindex, pSourceData, pExpectedSize, \
   242                    UNS8 bSubindex,
   230                   checkAccess, 1)
   243                    void * pSourceData,
       
   244                    UNS32 * pExpectedSize,
       
   245                    UNS8 checkAccess);
   231 
   246 
   232 /** @fn UNS32 writeLocalDict(d, wIndex, bSubindex, pSourceData, pExpectedSize, checkAccess)
   247 /** @fn UNS32 writeLocalDict(d, wIndex, bSubindex, pSourceData, pExpectedSize, checkAccess)
   233  * @ingroup od
   248  * @ingroup od
   234  * @hideinitializer
   249  * @hideinitializer
   235  * @brief Writes machine native SourceData to OD.
   250  * @brief Writes machine native SourceData to OD.
   255  * B = 0xFF; // set transmission type
   270  * B = 0xFF; // set transmission type
   256  *
   271  *
   257  * retcode = writeLocalDict( (UNS16)0x1800, (UNS8)2, &B, sizeof(UNS8), 1 );
   272  * retcode = writeLocalDict( (UNS16)0x1800, (UNS8)2, &B, sizeof(UNS8), 1 );
   258  * @endcode
   273  * @endcode
   259  */
   274  */
   260 #define writeLocalDict( d, wIndex, bSubindex, pSourceData, pExpectedSize, checkAccess) \
   275 UNS32 writeLocalDict( CO_Data* d,
   261        _setODentry( d, wIndex, bSubindex, pSourceData, pExpectedSize, checkAccess, 0)
   276                       UNS16 wIndex,
   262 
   277                       UNS8 bSubindex,
   263 
   278                       void * pSourceData,
   264 
   279                       UNS32 * pExpectedSize,
       
   280                       UNS8 checkAccess);
   265 /**
   281 /**
   266  * @brief Scan the index of object dictionary. Used only by setODentry and getODentry.
   282  * @brief Scan the index of object dictionary. Used only by setODentry and getODentry.
   267  * @param *d Pointer to a CAN object data structure
   283  * @param *d Pointer to a CAN object data structure
   268  * @param wIndex
   284  * @param wIndex
   269  * @param *errorCode :  OD_SUCCESSFUL if index foundor SDO abort code. (See file def.h)
   285  * @param *errorCode :  OD_SUCCESSFUL if index foundor SDO abort code. (See file def.h)
   272  */
   288  */
   273  const indextable * scanIndexOD (CO_Data* d, UNS16 wIndex, UNS32 *errorCode, ODCallback_t **Callback);
   289  const indextable * scanIndexOD (CO_Data* d, UNS16 wIndex, UNS32 *errorCode, ODCallback_t **Callback);
   274 
   290 
   275 UNS32 RegisterSetODentryCallBack(CO_Data* d, UNS16 wIndex, UNS8 bSubindex, ODCallback_t Callback);
   291 UNS32 RegisterSetODentryCallBack(CO_Data* d, UNS16 wIndex, UNS8 bSubindex, ODCallback_t Callback);
   276 
   292 
       
   293 #ifdef __cplusplus
       
   294 }
       
   295 #endif
       
   296 
   277 #endif /* __objacces_h__ */
   297 #endif /* __objacces_h__ */