/home/epimerde/documents/tc11/CanFestival-3/include/objacces.h

Go to the documentation of this file.
00001 /*
00002 This file is part of CanFestival, a library implementing CanOpen Stack. 
00003 
00004 Copyright (C): Edouard TISSERANT and Francis DUPIN
00005 
00006 See COPYING file for copyrights details.
00007 
00008 This library is free software; you can redistribute it and/or
00009 modify it under the terms of the GNU Lesser General Public
00010 License as published by the Free Software Foundation; either
00011 version 2.1 of the License, or (at your option) any later version.
00012 
00013 This library is distributed in the hope that it will be useful,
00014 but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016 Lesser General Public License for more details.
00017 
00018 You should have received a copy of the GNU Lesser General Public
00019 License along with this library; if not, write to the Free Software
00020 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021 */
00022 
00034 #ifndef __objacces_h__
00035 #define __objacces_h__
00036 
00037 #include <applicfg.h>
00038 
00039 typedef UNS32 (*valueRangeTest_t)(UNS8 typeValue, void *Value);
00040 typedef void (* storeODSubIndex_t)(UNS16 wIndex, UNS8 bSubindex);
00041 void _storeODSubIndex (UNS16 wIndex, UNS8 bSubindex);
00042 
00043 #include "data.h"
00044 
00045 
00046 
00047 /*
00048 Print MSG_WAR (s) if error to the access to the object dictionary occurs.
00049 You must uncomment the lines
00050 //#define DEBUG_CAN
00051 //#define DEBUG_WAR_CONSOLE_ON
00052 //#define DEBUG_ERR_CONSOLE_ON
00053 in the file objaccess.c
00054 sizeDataDict : Size of the data defined in the dictionary
00055 sizeDataGiven : Size data given by the user.
00056 code : error code to print. (SDO abort code. See file def.h)
00057 Beware that sometimes, we force the sizeDataDict or sizeDataGiven to 0, when we wants to use
00058 this function but we do not have the access to the right value. One example is
00059 getSDOerror(). So do not take attention to these variables if they are null.
00060 */
00061 
00062 UNS8 accessDictionaryError(UNS16 index, UNS8 subIndex, 
00063                            UNS8 sizeDataDict, UNS8 sizeDataGiven, UNS32 code);
00064 
00065 
00066 /* Reads an entry from the object dictionary.\n
00067  *  \code
00068  *  // Example usage:
00069  *  UNS8  *pbData;
00070  *  UNS8 length;
00071  *  UNS32 returnValue;
00072  *
00073  *  returnValue = getODentry( (UNS16)0x100B, (UNS8)1, 
00074  *  (void * *)&pbData, (UNS8 *)&length );
00075  *  if( returnValue != SUCCESSFUL )
00076  *  {
00077  *      // error handling
00078  *  }
00079  *  \endcode 
00080  *  \param wIndex The index in the object dictionary where you want to read
00081  *                an entry
00082  *  \param bSubindex The subindex of the Index. e.g. mostly subindex 0 is
00083  *                   used to tell you how many valid entries you can find
00084  *                   in this index. Look at the canopen standard for further
00085  *                   information
00086  *  \param ppbData Pointer to the pointer which points to the variable where
00087  *                 the value of this object dictionary entry should be copied
00088  *  \param pdwSize This function writes the size of the copied value (in Byte)
00089  *                 into this variable.
00090  *  \param pDataType : The type of the data. See objdictdef.h
00091  *  \param CheckAccess if other than 0, do not read if the data is Write Only
00092  *                     [Not used today. Put always 0].
00093  *  \return OD_SUCCESSFUL or SDO abort code. (See file def.h)
00094  */
00095 UNS32 getODentry( CO_Data* d, 
00096                   UNS16 wIndex,
00097                   UNS8 bSubindex,
00098                   void * pDestData,
00099                   UNS8 * pExpectedSize,
00100                   UNS8 * pDataType,
00101                   UNS8 checkAccess);
00102 
00103 
00104 /* By this function you can write an entry into the object dictionary\n
00105  *  \code
00106  *  // Example usage:
00107  *  UNS8 B;
00108  *  B = 0xFF; // set transmission type
00109  *
00110  *  retcode = setODentry( (UNS16)0x1800, (UNS8)2, &B, sizeof(UNS8), 1 );
00111  *  \endocde
00112  *  \param wIndex The index in the object dictionary where you want to write
00113  *                an entry
00114  *  \param bSubindex The subindex of the Index. e.g. mostly subindex 0 is
00115  *                   used to tell you how many valid entries you can find
00116  *                   in this index. Look at the canopen standard for further
00117  *                   information
00118  *  \param pbData Pointer to the variable that holds the value that should
00119  *                 be copied into the object dictionary
00120  *  \param dwSize The size of the value (in Byte).
00121  *  \param CheckAccess if other than 0, do not read if the data is Read Only or Constant
00122  *  \return OD_SUCCESSFUL or SDO abort code. (See file def.h)
00123  */
00124 UNS32 setODentry( CO_Data* d, 
00125                   UNS16 wIndex,
00126                   UNS8 bSubindex, 
00127                   void * pSourceData, 
00128                   UNS8 * pExpectedSize, 
00129                   UNS8 checkAccess);
00130 
00131 /*The same, without endianisation*/
00132 UNS32 writeLocalDict( CO_Data* d, 
00133                   UNS16 wIndex,
00134                   UNS8 bSubindex, 
00135                   void * pSourceData, 
00136                   UNS8 * pExpectedSize, 
00137                   UNS8 checkAccess);
00138 
00139 
00140 /* Scan the index of object dictionary. Used only by setODentry and getODentry.
00141  *  *errorCode :  OD_SUCCESSFUL if index foundor SDO abort code. (See file def.h)
00142  *  Return NULL if index not found. Else : return the table part of the object dictionary.
00143  */
00144  const indextable * scanIndexOD (CO_Data* d, UNS16 wIndex, UNS32 *errorCode, ODCallback_t **Callback);
00145 
00146 UNS32 RegisterSetODentryCallBack(CO_Data* d, UNS16 wIndex, UNS8 bSubindex, ODCallback_t Callback);
00147 
00148 #endif /* __objacces_h__ */

Generated on Mon Jun 4 16:29:06 2007 for CanFestival by  doxygen 1.5.1