# HG changeset patch # User 'Gr?gory Tr?lat ' # Date 1253779387 -7200 # Node ID 17a171fe7c56a509b7aa54f8b04b20a17939212f # Parent 44702aa24113f1a4e15fe73a8d76fe6abf96b294 re-use macro for objaccess diff -r 44702aa24113 -r 17a171fe7c56 include/objacces.h --- a/include/objacces.h Thu Sep 24 09:29:07 2009 +0200 +++ b/include/objacces.h Thu Sep 24 10:03:07 2009 +0200 @@ -120,7 +120,6 @@ UNS8 checkAccess, UNS8 endianize); - /** * @ingroup od * @brief getODentry() to read from object and endianize @@ -142,13 +141,10 @@ * - OD_SUCCESSFUL is returned upon success. * - SDO abort code is returned if error occurs . (See file def.h) */ -UNS32 getODentry( CO_Data* d, - UNS16 wIndex, - UNS8 bSubindex, - void * pDestData, - UNS32 * pExpectedSize, - UNS8 * pDataType, - UNS8 checkAccess); +#define getODentry( OD, wIndex, bSubindex, pDestData, pExpectedSize, \ + pDataType, checkAccess) \ + _getODentry( OD, wIndex, bSubindex, pDestData, pExpectedSize, \ + pDataType, checkAccess, 1) /** * @ingroup od @@ -175,13 +171,10 @@ * - OD_SUCCESSFUL is returned upon success. * - SDO abort code is returned if error occurs . (See file def.h) */ -UNS32 readLocalDict( CO_Data* d, - UNS16 wIndex, - UNS8 bSubindex, - void * pDestData, - UNS32 * pExpectedSize, - UNS8 * pDataType, - UNS8 checkAccess); +#define readLocalDict( OD, wIndex, bSubindex, pDestData, pExpectedSize, \ + pDataType, checkAccess) \ + _getODentry( OD, wIndex, bSubindex, pDestData, pExpectedSize, \ + pDataType, checkAccess, 0) /* By this function you can write an entry into the object dictionary * @param *d Pointer to a CAN object data structure @@ -237,12 +230,10 @@ * - OD_SUCCESSFUL is returned upon success. * - SDO abort code is returned if error occurs . (See file def.h) */ -UNS32 setODentry( CO_Data* d, - UNS16 wIndex, - UNS8 bSubindex, - void * pSourceData, - UNS32 * pExpectedSize, - UNS8 checkAccess); +#define setODentry( d, wIndex, bSubindex, pSourceData, pExpectedSize, \ + checkAccess) \ + _setODentry( d, wIndex, bSubindex, pSourceData, pExpectedSize, \ + checkAccess, 1) /** @fn UNS32 writeLocalDict(d, wIndex, bSubindex, pSourceData, pExpectedSize, checkAccess) * @ingroup od @@ -272,12 +263,11 @@ * retcode = writeLocalDict( (UNS16)0x1800, (UNS8)2, &B, sizeof(UNS8), 1 ); * @endcode */ -UNS32 writeLocalDict( CO_Data* d, - UNS16 wIndex, - UNS8 bSubindex, - void * pSourceData, - UNS32 * pExpectedSize, - UNS8 checkAccess); +#define writeLocalDict( d, wIndex, bSubindex, pSourceData, pExpectedSize, checkAccess) \ + _setODentry( d, wIndex, bSubindex, pSourceData, pExpectedSize, checkAccess, 0) + + + /** * @brief Scan the index of object dictionary. Used only by setODentry and getODentry. * @param *d Pointer to a CAN object data structure diff -r 44702aa24113 -r 17a171fe7c56 src/objacces.c --- a/src/objacces.c Thu Sep 24 09:29:07 2009 +0200 +++ b/src/objacces.c Thu Sep 24 10:03:07 2009 +0200 @@ -168,30 +168,6 @@ } } -UNS32 getODentry( CO_Data* OD, - UNS16 wIndex, - UNS8 bSubindex, - void * pDestData, - UNS32 * pExpectedSize, - UNS8 * pDataType, - UNS8 checkAccess) -{ - return _getODentry( OD, wIndex, bSubindex, pDestData, pExpectedSize, - pDataType, checkAccess, 1); -} - -UNS32 readLocalDict( CO_Data* OD, - UNS16 wIndex, - UNS8 bSubindex, - void * pDestData, - UNS32 * pExpectedSize, - UNS8 * pDataType, - UNS8 checkAccess) -{ - return _getODentry( OD, wIndex, bSubindex, pDestData, pExpectedSize, - pDataType, checkAccess, 0); -} - UNS32 _setODentry( CO_Data* d, UNS16 wIndex, UNS8 bSubindex, @@ -285,27 +261,6 @@ } } -UNS32 setODentry( CO_Data* d, - UNS16 wIndex, - UNS8 bSubindex, - void * pSourceData, - UNS32 * pExpectedSize, - UNS8 checkAccess) -{ - return _setODentry( d, wIndex, bSubindex, pSourceData, pExpectedSize, - checkAccess, 1); -} - -UNS32 writeLocalDict( CO_Data* d, - UNS16 wIndex, - UNS8 bSubindex, - void * pSourceData, - UNS32 * pExpectedSize, - UNS8 checkAccess) -{ - return _setODentry( d, wIndex, bSubindex, pSourceData, pExpectedSize, checkAccess, 0); -} - const indextable * scanIndexOD (CO_Data* d, UNS16 wIndex, UNS32 *errorCode, ODCallback_t **Callback) { return (*d->scanIndexOD)(wIndex, errorCode, Callback); diff -r 44702aa24113 -r 17a171fe7c56 src/win32/CanFestival-3.def --- a/src/win32/CanFestival-3.def Thu Sep 24 09:29:07 2009 +0200 +++ b/src/win32/CanFestival-3.def Thu Sep 24 10:03:07 2009 +0200 @@ -48,10 +48,8 @@ ; objacces.h _storeODSubIndex accessDictionaryError - getODentry - setODentry - writeLocalDict - readLocalDict + _getODentry + _setODentry scanIndexOD RegisterSetODentryCallBack