nico@207: nico@207: nico@207: CanFestival: /home/epimerde/documents/tc11/CanFestival-3/include/objacces.h Source File nico@207: nico@207: nico@207: nico@207: nico@207:
nico@207:
nico@207:
nico@207:
nico@207:

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

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

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