Replace macro functions for setODentry and getODentry
authorgreg
Wed, 16 Sep 2009 15:16:19 +0200
changeset 588 ee181b4f177b
parent 587 c175351a6994
child 589 06f6c12d5f78
Replace macro functions for setODentry and getODentry
(prevent compilation errors with visual studio c++ compiler)
include/objacces.h
src/objacces.c
--- a/include/objacces.h	Wed Sep 16 15:15:28 2009 +0200
+++ b/include/objacces.h	Wed Sep 16 15:16:19 2009 +0200
@@ -41,6 +41,12 @@
 
 #include <applicfg.h>
 
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
 typedef UNS32 (*valueRangeTest_t)(UNS8 typeValue, void *Value);
 typedef void (* storeODSubIndex_t)(CO_Data* d, UNS16 wIndex, UNS8 bSubindex);
 void _storeODSubIndex (CO_Data* d, UNS16 wIndex, UNS8 bSubindex);
@@ -105,14 +111,15 @@
  * - 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,
-		  UNS8 endianize);
+UNS32 _getODentry( CO_Data* d,
+                   UNS16 wIndex,
+                   UNS8 bSubindex,
+                   void * pDestData,
+                   UNS32 * pExpectedSize,
+                   UNS8 * pDataType,
+                   UNS8 checkAccess,
+                   UNS8 endianize);
+
 
 /** 
  * @ingroup od
@@ -135,10 +142,13 @@
  * - OD_SUCCESSFUL is returned upon success. 
  * - SDO abort code is returned if error occurs . (See file def.h)
  */
-#define getODentry( OD, wIndex, bSubindex, pDestData, pExpectedSize, \
-		          pDataType,  checkAccess)                         \
-       _getODentry( OD, wIndex, bSubindex, pDestData, pExpectedSize, \
-		          pDataType,  checkAccess, 1)            
+UNS32 getODentry( CO_Data* d,
+                  UNS16 wIndex,
+                  UNS8 bSubindex,
+                  void * pDestData,
+                  UNS32 * pExpectedSize,
+                  UNS8 * pDataType,
+                  UNS8 checkAccess);
 
 /** 
  * @ingroup od
@@ -165,10 +175,13 @@
  * - OD_SUCCESSFUL is returned upon success. 
  * - SDO abort code is returned if error occurs . (See file def.h)
  */
-#define readLocalDict( OD, wIndex, bSubindex, pDestData, pExpectedSize, \
-		          pDataType,  checkAccess)                         \
-       _getODentry( OD, wIndex, bSubindex, pDestData, pExpectedSize, \
-		          pDataType,  checkAccess, 0)
+UNS32 readLocalDict( CO_Data* d,
+                     UNS16 wIndex,
+                     UNS8 bSubindex,
+                     void * pDestData,
+                     UNS32 * pExpectedSize,
+                     UNS8 * pDataType,
+                     UNS8 checkAccess);
 
 /* By this function you can write an entry into the object dictionary
  * @param *d Pointer to a CAN object data structure
@@ -224,10 +237,12 @@
  * - OD_SUCCESSFUL is returned upon success. 
  * - SDO abort code is returned if error occurs . (See file def.h)
  */
-#define setODentry( d, wIndex, bSubindex, pSourceData, pExpectedSize, \
-                  checkAccess) \
-       _setODentry( d, wIndex, bSubindex, pSourceData, pExpectedSize, \
-                  checkAccess, 1)
+UNS32 setODentry( CO_Data* d,
+                   UNS16 wIndex,
+                   UNS8 bSubindex,
+                   void * pSourceData,
+                   UNS32 * pExpectedSize,
+                   UNS8 checkAccess);
 
 /** @fn UNS32 writeLocalDict(d, wIndex, bSubindex, pSourceData, pExpectedSize, checkAccess)
  * @ingroup od
@@ -257,11 +272,12 @@
  * retcode = writeLocalDict( (UNS16)0x1800, (UNS8)2, &B, sizeof(UNS8), 1 );
  * @endcode
  */
-#define writeLocalDict( d, wIndex, bSubindex, pSourceData, pExpectedSize, checkAccess) \
-       _setODentry( d, wIndex, bSubindex, pSourceData, pExpectedSize, checkAccess, 0)
-
-
-
+UNS32 writeLocalDict( CO_Data* d,
+                      UNS16 wIndex,
+                      UNS8 bSubindex,
+                      void * pSourceData,
+                      UNS32 * pExpectedSize,
+                      UNS8 checkAccess);
 /**
  * @brief Scan the index of object dictionary. Used only by setODentry and getODentry.
  * @param *d Pointer to a CAN object data structure
@@ -274,4 +290,8 @@
 
 UNS32 RegisterSetODentryCallBack(CO_Data* d, UNS16 wIndex, UNS8 bSubindex, ODCallback_t Callback);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* __objacces_h__ */
--- a/src/objacces.c	Wed Sep 16 15:15:28 2009 +0200
+++ b/src/objacces.c	Wed Sep 16 15:16:19 2009 +0200
@@ -40,18 +40,6 @@
 
 #include "data.h"
 
-
-/*!
-**
-**
-** @param index
-** @param subIndex
-** @param sizeDataDict
-** @param sizeDataGiven
-** @param code
-**
-** @return
-**/
 #ifdef DEBUG_WAR_CONSOLE_ON
 UNS8 accessDictionaryError(UNS16 index, UNS8 subIndex,
                            UNS32 sizeDataDict, UNS32 sizeDataGiven, UNS32 code)
@@ -90,20 +78,6 @@
 #define accessDictionaryError(index, subIndex, sizeDataDict, sizeDataGiven, code)
 #endif
 
-/*!
-**
-**
-** @param d
-** @param wIndex
-** @param bSubindex
-** @param pDestData
-** @param pExpectedSize
-** @param pDataType
-** @param checkAccess
-** @param endianize
-**
-** @return
-**/
 UNS32 _getODentry( CO_Data* d,
                    UNS16 wIndex,
                    UNS8 bSubindex,
@@ -194,19 +168,30 @@
   }
 }
 
-/*!
-**
-**
-** @param d
-** @param wIndex
-** @param bSubindex
-** @param pSourceData
-** @param pExpectedSize
-** @param checkAccess
-** @param endianize
-**
-** @return
-**/
+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,
@@ -300,31 +285,32 @@
     }
 }
 
-/*!
-**
-**
-** @param d
-** @param wIndex
-** @param errorCode
-** @param Callback
-**
-** @return
-**/
+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);
 }
 
-/*!
-**
-**
-** @param d
-** @param wIndex
-** @param bSubindex
-** @param Callback
-**
-** @return
-**/
 UNS32 RegisterSetODentryCallBack(CO_Data* d, UNS16 wIndex, UNS8 bSubindex, ODCallback_t Callback)
 {
 UNS32 errorCode;
@@ -337,10 +323,4 @@
   return errorCode;
 }
 
-/*!
-**
-**
-** @param wIndex
-** @param bSubindex
-**/
 void _storeODSubIndex (CO_Data* d, UNS16 wIndex, UNS8 bSubindex){}