re-use macro for objaccess
author'Gr?gory Tr?lat <gregory.trelat@lolitech.fr>'
Thu, 24 Sep 2009 10:03:07 +0200
changeset 594 17a171fe7c56
parent 593 44702aa24113
child 595 3a9b09a0dd06
child 600 7767029937aa
re-use macro for objaccess
include/objacces.h
src/objacces.c
src/win32/CanFestival-3.def
--- 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
--- 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);
--- 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