Sam Grove
/
canopen_slavenode
CANfestival - an open source CANopen framework
framework/include/objacces.h@0:6219434a0cb5, 2011-05-30 (annotated)
- Committer:
- sam_grove
- Date:
- Mon May 30 07:14:41 2011 +0000
- Revision:
- 0:6219434a0cb5
Initial public release of slave node framework port
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sam_grove |
0:6219434a0cb5 | 1 | /* |
sam_grove |
0:6219434a0cb5 | 2 | This file is part of CanFestival, a library implementing CanOpen Stack. |
sam_grove |
0:6219434a0cb5 | 3 | |
sam_grove |
0:6219434a0cb5 | 4 | Copyright (C): Edouard TISSERANT and Francis DUPIN |
sam_grove |
0:6219434a0cb5 | 5 | |
sam_grove |
0:6219434a0cb5 | 6 | See COPYING file for copyrights details. |
sam_grove |
0:6219434a0cb5 | 7 | |
sam_grove |
0:6219434a0cb5 | 8 | This library is free software; you can redistribute it and/or |
sam_grove |
0:6219434a0cb5 | 9 | modify it under the terms of the GNU Lesser General Public |
sam_grove |
0:6219434a0cb5 | 10 | License as published by the Free Software Foundation; either |
sam_grove |
0:6219434a0cb5 | 11 | version 2.1 of the License, or (at your option) any later version. |
sam_grove |
0:6219434a0cb5 | 12 | |
sam_grove |
0:6219434a0cb5 | 13 | This library is distributed in the hope that it will be useful, |
sam_grove |
0:6219434a0cb5 | 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
sam_grove |
0:6219434a0cb5 | 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
sam_grove |
0:6219434a0cb5 | 16 | Lesser General Public License for more details. |
sam_grove |
0:6219434a0cb5 | 17 | |
sam_grove |
0:6219434a0cb5 | 18 | You should have received a copy of the GNU Lesser General Public |
sam_grove |
0:6219434a0cb5 | 19 | License along with this library; if not, write to the Free Software |
sam_grove |
0:6219434a0cb5 | 20 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
sam_grove |
0:6219434a0cb5 | 21 | */ |
sam_grove |
0:6219434a0cb5 | 22 | |
sam_grove |
0:6219434a0cb5 | 23 | /** @file |
sam_grove |
0:6219434a0cb5 | 24 | * @brief Responsible for accessing the object dictionary. |
sam_grove |
0:6219434a0cb5 | 25 | * |
sam_grove |
0:6219434a0cb5 | 26 | * This file contains functions for accessing the object dictionary and |
sam_grove |
0:6219434a0cb5 | 27 | * variables that are contained by the object dictionary. |
sam_grove |
0:6219434a0cb5 | 28 | * Accessing the object dictionary contains setting local variables |
sam_grove |
0:6219434a0cb5 | 29 | * as PDOs and accessing (read/write) all entries of the object dictionary |
sam_grove |
0:6219434a0cb5 | 30 | * @warning Only the basic entries of an object dictionary are included |
sam_grove |
0:6219434a0cb5 | 31 | * at the moment. |
sam_grove |
0:6219434a0cb5 | 32 | */ |
sam_grove |
0:6219434a0cb5 | 33 | |
sam_grove |
0:6219434a0cb5 | 34 | /** @defgroup od Object Dictionary Management |
sam_grove |
0:6219434a0cb5 | 35 | * @brief The Object Dictionary is the heart of each CANopen device containing all communication and application objects. |
sam_grove |
0:6219434a0cb5 | 36 | * @ingroup userapi |
sam_grove |
0:6219434a0cb5 | 37 | */ |
sam_grove |
0:6219434a0cb5 | 38 | |
sam_grove |
0:6219434a0cb5 | 39 | #ifndef __objacces_h__ |
sam_grove |
0:6219434a0cb5 | 40 | #define __objacces_h__ |
sam_grove |
0:6219434a0cb5 | 41 | |
sam_grove |
0:6219434a0cb5 | 42 | #include <applicfg.h> |
sam_grove |
0:6219434a0cb5 | 43 | |
sam_grove |
0:6219434a0cb5 | 44 | |
sam_grove |
0:6219434a0cb5 | 45 | #ifdef __cplusplus |
sam_grove |
0:6219434a0cb5 | 46 | extern "C" { |
sam_grove |
0:6219434a0cb5 | 47 | #endif |
sam_grove |
0:6219434a0cb5 | 48 | |
sam_grove |
0:6219434a0cb5 | 49 | |
sam_grove |
0:6219434a0cb5 | 50 | typedef UNS32 (*valueRangeTest_t)(UNS8 typeValue, void *Value); |
sam_grove |
0:6219434a0cb5 | 51 | typedef void (* storeODSubIndex_t)(CO_Data* d, UNS16 wIndex, UNS8 bSubindex); |
sam_grove |
0:6219434a0cb5 | 52 | void _storeODSubIndex (CO_Data* d, UNS16 wIndex, UNS8 bSubindex); |
sam_grove |
0:6219434a0cb5 | 53 | |
sam_grove |
0:6219434a0cb5 | 54 | /** |
sam_grove |
0:6219434a0cb5 | 55 | * @brief Print MSG_WAR (s) if error to the access to the object dictionary occurs. |
sam_grove |
0:6219434a0cb5 | 56 | * |
sam_grove |
0:6219434a0cb5 | 57 | * You must uncomment the lines in the file objaccess.c :\n |
sam_grove |
0:6219434a0cb5 | 58 | * //#define DEBUG_CAN\n |
sam_grove |
0:6219434a0cb5 | 59 | * //#define DEBUG_WAR_CONSOLE_ON\n |
sam_grove |
0:6219434a0cb5 | 60 | * //#define DEBUG_ERR_CONSOLE_ON\n\n |
sam_grove |
0:6219434a0cb5 | 61 | * Beware that sometimes, we force the sizeDataDict or sizeDataGiven to 0, when we wants to use |
sam_grove |
0:6219434a0cb5 | 62 | * this function but we do not have the access to the right value. One example is |
sam_grove |
0:6219434a0cb5 | 63 | * getSDOerror(). So do not take attention to these variables if they are null. |
sam_grove |
0:6219434a0cb5 | 64 | * @param index |
sam_grove |
0:6219434a0cb5 | 65 | * @param subIndex |
sam_grove |
0:6219434a0cb5 | 66 | * @param sizeDataDict Size of the data defined in the dictionary |
sam_grove |
0:6219434a0cb5 | 67 | * @param sizeDataGiven Size data given by the user. |
sam_grove |
0:6219434a0cb5 | 68 | * @param code error code to print. (SDO abort code. See file def.h) |
sam_grove |
0:6219434a0cb5 | 69 | * @return |
sam_grove |
0:6219434a0cb5 | 70 | */ |
sam_grove |
0:6219434a0cb5 | 71 | UNS8 accessDictionaryError(UNS16 index, UNS8 subIndex, |
sam_grove |
0:6219434a0cb5 | 72 | UNS32 sizeDataDict, UNS32 sizeDataGiven, UNS32 code); |
sam_grove |
0:6219434a0cb5 | 73 | |
sam_grove |
0:6219434a0cb5 | 74 | |
sam_grove |
0:6219434a0cb5 | 75 | /* _getODentry() Reads an entry from the object dictionary.\n |
sam_grove |
0:6219434a0cb5 | 76 | * |
sam_grove |
0:6219434a0cb5 | 77 | * use getODentry() macro to read from object and endianize |
sam_grove |
0:6219434a0cb5 | 78 | * use readLocalDict() macro to read from object and not endianize |
sam_grove |
0:6219434a0cb5 | 79 | * |
sam_grove |
0:6219434a0cb5 | 80 | * @code |
sam_grove |
0:6219434a0cb5 | 81 | * // Example usage: |
sam_grove |
0:6219434a0cb5 | 82 | * UNS8 *pbData; |
sam_grove |
0:6219434a0cb5 | 83 | * UNS8 length; |
sam_grove |
0:6219434a0cb5 | 84 | * UNS32 returnValue; |
sam_grove |
0:6219434a0cb5 | 85 | * |
sam_grove |
0:6219434a0cb5 | 86 | * returnValue = getODentry( (UNS16)0x100B, (UNS8)1, |
sam_grove |
0:6219434a0cb5 | 87 | * (void * *)&pbData, (UNS8 *)&length ); |
sam_grove |
0:6219434a0cb5 | 88 | * if( returnValue != SUCCESSFUL ) |
sam_grove |
0:6219434a0cb5 | 89 | * { |
sam_grove |
0:6219434a0cb5 | 90 | * // error handling |
sam_grove |
0:6219434a0cb5 | 91 | * } |
sam_grove |
0:6219434a0cb5 | 92 | * @endcode |
sam_grove |
0:6219434a0cb5 | 93 | * @param *d Pointer to a CAN object data structure |
sam_grove |
0:6219434a0cb5 | 94 | * @param wIndex The index in the object dictionary where you want to read |
sam_grove |
0:6219434a0cb5 | 95 | * an entry |
sam_grove |
0:6219434a0cb5 | 96 | * @param bSubindex The subindex of the Index. e.g. mostly subindex 0 is |
sam_grove |
0:6219434a0cb5 | 97 | * used to tell you how many valid entries you can find |
sam_grove |
0:6219434a0cb5 | 98 | * in this index. Look at the canopen standard for further |
sam_grove |
0:6219434a0cb5 | 99 | * information |
sam_grove |
0:6219434a0cb5 | 100 | * @param *pDestData Pointer to the pointer which points to the variable where |
sam_grove |
0:6219434a0cb5 | 101 | * the value of this object dictionary entry should be copied |
sam_grove |
0:6219434a0cb5 | 102 | * @param pExpectedSize This function writes the size of the copied value (in Byte) |
sam_grove |
0:6219434a0cb5 | 103 | * into this variable. |
sam_grove |
0:6219434a0cb5 | 104 | * @param *pDataType Pointer to the type of the data. See objdictdef.h |
sam_grove |
0:6219434a0cb5 | 105 | * @param CheckAccess if other than 0, do not read if the data is Write Only |
sam_grove |
0:6219434a0cb5 | 106 | * [Not used today. Put always 0]. |
sam_grove |
0:6219434a0cb5 | 107 | * @param Endianize When not 0, data is endianized into network byte order |
sam_grove |
0:6219434a0cb5 | 108 | * when 0, data is not endianized and copied in machine native |
sam_grove |
0:6219434a0cb5 | 109 | * endianness |
sam_grove |
0:6219434a0cb5 | 110 | * @return |
sam_grove |
0:6219434a0cb5 | 111 | * - OD_SUCCESSFUL is returned upon success. |
sam_grove |
0:6219434a0cb5 | 112 | * - SDO abort code is returned if error occurs . (See file def.h) |
sam_grove |
0:6219434a0cb5 | 113 | */ |
sam_grove |
0:6219434a0cb5 | 114 | UNS32 _getODentry( CO_Data* d, |
sam_grove |
0:6219434a0cb5 | 115 | UNS16 wIndex, |
sam_grove |
0:6219434a0cb5 | 116 | UNS8 bSubindex, |
sam_grove |
0:6219434a0cb5 | 117 | void * pDestData, |
sam_grove |
0:6219434a0cb5 | 118 | UNS32 * pExpectedSize, |
sam_grove |
0:6219434a0cb5 | 119 | UNS8 * pDataType, |
sam_grove |
0:6219434a0cb5 | 120 | UNS8 checkAccess, |
sam_grove |
0:6219434a0cb5 | 121 | UNS8 endianize); |
sam_grove |
0:6219434a0cb5 | 122 | |
sam_grove |
0:6219434a0cb5 | 123 | /** |
sam_grove |
0:6219434a0cb5 | 124 | * @ingroup od |
sam_grove |
0:6219434a0cb5 | 125 | * @brief getODentry() to read from object and endianize |
sam_grove |
0:6219434a0cb5 | 126 | * @param OD Pointer to a CAN object data structure |
sam_grove |
0:6219434a0cb5 | 127 | * @param wIndex The index in the object dictionary where you want to read |
sam_grove |
0:6219434a0cb5 | 128 | * an entry |
sam_grove |
0:6219434a0cb5 | 129 | * @param bSubindex The subindex of the Index. e.g. mostly subindex 0 is |
sam_grove |
0:6219434a0cb5 | 130 | * used to tell you how many valid entries you can find |
sam_grove |
0:6219434a0cb5 | 131 | * in this index. Look at the canopen standard for further |
sam_grove |
0:6219434a0cb5 | 132 | * information |
sam_grove |
0:6219434a0cb5 | 133 | * @param *pDestData Pointer to the pointer which points to the variable where |
sam_grove |
0:6219434a0cb5 | 134 | * the value of this object dictionary entry should be copied |
sam_grove |
0:6219434a0cb5 | 135 | * @param pExpectedSize This function writes the size of the copied value (in Byte) |
sam_grove |
0:6219434a0cb5 | 136 | * into this variable. |
sam_grove |
0:6219434a0cb5 | 137 | * @param *pDataType Pointer to the type of the data. See objdictdef.h |
sam_grove |
0:6219434a0cb5 | 138 | * @param checkAccess Flag that indicate if a check rights must be perfomed (0 : no , other than 0 : yes) |
sam_grove |
0:6219434a0cb5 | 139 | * @param endianize Set to 1 : endianized into network byte order |
sam_grove |
0:6219434a0cb5 | 140 | * @return |
sam_grove |
0:6219434a0cb5 | 141 | * - OD_SUCCESSFUL is returned upon success. |
sam_grove |
0:6219434a0cb5 | 142 | * - SDO abort code is returned if error occurs . (See file def.h) |
sam_grove |
0:6219434a0cb5 | 143 | */ |
sam_grove |
0:6219434a0cb5 | 144 | #define getODentry( OD, wIndex, bSubindex, pDestData, pExpectedSize, \ |
sam_grove |
0:6219434a0cb5 | 145 | pDataType, checkAccess) \ |
sam_grove |
0:6219434a0cb5 | 146 | _getODentry( OD, wIndex, bSubindex, pDestData, pExpectedSize, \ |
sam_grove |
0:6219434a0cb5 | 147 | pDataType, checkAccess, 1) |
sam_grove |
0:6219434a0cb5 | 148 | |
sam_grove |
0:6219434a0cb5 | 149 | /** |
sam_grove |
0:6219434a0cb5 | 150 | * @ingroup od |
sam_grove |
0:6219434a0cb5 | 151 | * @brief readLocalDict() reads an entry from the object dictionary, but in |
sam_grove |
0:6219434a0cb5 | 152 | * contrast to getODentry(), readLocalDict() doesn't endianize entry and reads |
sam_grove |
0:6219434a0cb5 | 153 | * entry in machine native endianness. |
sam_grove |
0:6219434a0cb5 | 154 | * @param OD Pointer to a CAN object data structure |
sam_grove |
0:6219434a0cb5 | 155 | * @param wIndex The index in the object dictionary where you want to read |
sam_grove |
0:6219434a0cb5 | 156 | * an entry |
sam_grove |
0:6219434a0cb5 | 157 | * @param bSubindex The subindex of the Index. e.g. mostly subindex 0 is |
sam_grove |
0:6219434a0cb5 | 158 | * used to tell you how many valid entries you can find |
sam_grove |
0:6219434a0cb5 | 159 | * in this index. Look at the canopen standard for further |
sam_grove |
0:6219434a0cb5 | 160 | * information |
sam_grove |
0:6219434a0cb5 | 161 | * @param *pDestData Pointer to the pointer which points to the variable where |
sam_grove |
0:6219434a0cb5 | 162 | * the value of this object dictionary entry should be copied |
sam_grove |
0:6219434a0cb5 | 163 | * @param pExpectedSize This function writes the size of the copied value (in Byte) |
sam_grove |
0:6219434a0cb5 | 164 | * into this variable. |
sam_grove |
0:6219434a0cb5 | 165 | * @param *pDataType Pointer to the type of the data. See objdictdef.h |
sam_grove |
0:6219434a0cb5 | 166 | * @param checkAccess if other than 0, do not read if the data is Write Only |
sam_grove |
0:6219434a0cb5 | 167 | * [Not used today. Put always 0]. |
sam_grove |
0:6219434a0cb5 | 168 | * @param endianize Set to 0, data is not endianized and copied in machine native |
sam_grove |
0:6219434a0cb5 | 169 | * endianness |
sam_grove |
0:6219434a0cb5 | 170 | * @return |
sam_grove |
0:6219434a0cb5 | 171 | * - OD_SUCCESSFUL is returned upon success. |
sam_grove |
0:6219434a0cb5 | 172 | * - SDO abort code is returned if error occurs . (See file def.h) |
sam_grove |
0:6219434a0cb5 | 173 | */ |
sam_grove |
0:6219434a0cb5 | 174 | #define readLocalDict( OD, wIndex, bSubindex, pDestData, pExpectedSize, \ |
sam_grove |
0:6219434a0cb5 | 175 | pDataType, checkAccess) \ |
sam_grove |
0:6219434a0cb5 | 176 | _getODentry( OD, wIndex, bSubindex, pDestData, pExpectedSize, \ |
sam_grove |
0:6219434a0cb5 | 177 | pDataType, checkAccess, 0) |
sam_grove |
0:6219434a0cb5 | 178 | |
sam_grove |
0:6219434a0cb5 | 179 | /* By this function you can write an entry into the object dictionary |
sam_grove |
0:6219434a0cb5 | 180 | * @param *d Pointer to a CAN object data structure |
sam_grove |
0:6219434a0cb5 | 181 | * @param wIndex The index in the object dictionary where you want to write |
sam_grove |
0:6219434a0cb5 | 182 | * an entry |
sam_grove |
0:6219434a0cb5 | 183 | * @param bSubindex The subindex of the Index. e.g. mostly subindex 0 is |
sam_grove |
0:6219434a0cb5 | 184 | * used to tell you how many valid entries you can find |
sam_grove |
0:6219434a0cb5 | 185 | * in this index. Look at the canopen standard for further |
sam_grove |
0:6219434a0cb5 | 186 | * information |
sam_grove |
0:6219434a0cb5 | 187 | * @param *pSourceData Pointer to the variable that holds the value that should |
sam_grove |
0:6219434a0cb5 | 188 | * be copied into the object dictionary |
sam_grove |
0:6219434a0cb5 | 189 | * @param *pExpectedSize The size of the value (in Byte). |
sam_grove |
0:6219434a0cb5 | 190 | * @param checkAccess Flag that indicate if a check rights must be perfomed (0 : no , other than 0 : yes) |
sam_grove |
0:6219434a0cb5 | 191 | * @param endianize When not 0, data is endianized into network byte order |
sam_grove |
0:6219434a0cb5 | 192 | * when 0, data is not endianized and copied in machine native |
sam_grove |
0:6219434a0cb5 | 193 | * endianness |
sam_grove |
0:6219434a0cb5 | 194 | * @return |
sam_grove |
0:6219434a0cb5 | 195 | * - OD_SUCCESSFUL is returned upon success. |
sam_grove |
0:6219434a0cb5 | 196 | * - SDO abort code is returned if error occurs . (See file def.h) |
sam_grove |
0:6219434a0cb5 | 197 | */ |
sam_grove |
0:6219434a0cb5 | 198 | UNS32 _setODentry( CO_Data* d, |
sam_grove |
0:6219434a0cb5 | 199 | UNS16 wIndex, |
sam_grove |
0:6219434a0cb5 | 200 | UNS8 bSubindex, |
sam_grove |
0:6219434a0cb5 | 201 | void * pSourceData, |
sam_grove |
0:6219434a0cb5 | 202 | UNS32 * pExpectedSize, |
sam_grove |
0:6219434a0cb5 | 203 | UNS8 checkAccess, |
sam_grove |
0:6219434a0cb5 | 204 | UNS8 endianize); |
sam_grove |
0:6219434a0cb5 | 205 | |
sam_grove |
0:6219434a0cb5 | 206 | /** |
sam_grove |
0:6219434a0cb5 | 207 | * @ingroup od |
sam_grove |
0:6219434a0cb5 | 208 | * @brief setODentry converts SourceData from network byte order to machine native |
sam_grove |
0:6219434a0cb5 | 209 | * format, and writes that to OD. |
sam_grove |
0:6219434a0cb5 | 210 | * @code |
sam_grove |
0:6219434a0cb5 | 211 | * // Example usage: |
sam_grove |
0:6219434a0cb5 | 212 | * UNS8 B; |
sam_grove |
0:6219434a0cb5 | 213 | * B = 0xFF; // set transmission type |
sam_grove |
0:6219434a0cb5 | 214 | * |
sam_grove |
0:6219434a0cb5 | 215 | * retcode = setODentry( (UNS16)0x1800, (UNS8)2, &B, sizeof(UNS8), 1 ); |
sam_grove |
0:6219434a0cb5 | 216 | * @endcode |
sam_grove |
0:6219434a0cb5 | 217 | * @param d Pointer to a CAN object data structure |
sam_grove |
0:6219434a0cb5 | 218 | * @param wIndex The index in the object dictionary where you want to write |
sam_grove |
0:6219434a0cb5 | 219 | * an entry |
sam_grove |
0:6219434a0cb5 | 220 | * @param bSubindex The subindex of the Index. e.g. mostly subindex 0 is |
sam_grove |
0:6219434a0cb5 | 221 | * used to tell you how many valid entries you can find |
sam_grove |
0:6219434a0cb5 | 222 | * in this index. Look at the canopen standard for further |
sam_grove |
0:6219434a0cb5 | 223 | * information |
sam_grove |
0:6219434a0cb5 | 224 | * @param *pSourceData Pointer to the variable that holds the value that should |
sam_grove |
0:6219434a0cb5 | 225 | * be copied into the object dictionary |
sam_grove |
0:6219434a0cb5 | 226 | * @param *pExpectedSize The size of the value (in Byte). |
sam_grove |
0:6219434a0cb5 | 227 | * @param checkAccess Flag that indicate if a check rights must be perfomed (0 : no , other than 0 : yes) |
sam_grove |
0:6219434a0cb5 | 228 | * @param endianize Set to 1 : endianized into network byte order |
sam_grove |
0:6219434a0cb5 | 229 | * @return |
sam_grove |
0:6219434a0cb5 | 230 | * - OD_SUCCESSFUL is returned upon success. |
sam_grove |
0:6219434a0cb5 | 231 | * - SDO abort code is returned if error occurs . (See file def.h) |
sam_grove |
0:6219434a0cb5 | 232 | */ |
sam_grove |
0:6219434a0cb5 | 233 | #define setODentry( d, wIndex, bSubindex, pSourceData, pExpectedSize, \ |
sam_grove |
0:6219434a0cb5 | 234 | checkAccess) \ |
sam_grove |
0:6219434a0cb5 | 235 | _setODentry( d, wIndex, bSubindex, pSourceData, pExpectedSize, \ |
sam_grove |
0:6219434a0cb5 | 236 | checkAccess, 1) |
sam_grove |
0:6219434a0cb5 | 237 | |
sam_grove |
0:6219434a0cb5 | 238 | /** @fn UNS32 writeLocalDict(d, wIndex, bSubindex, pSourceData, pExpectedSize, checkAccess) |
sam_grove |
0:6219434a0cb5 | 239 | * @ingroup od |
sam_grove |
0:6219434a0cb5 | 240 | * @hideinitializer |
sam_grove |
0:6219434a0cb5 | 241 | * @brief Writes machine native SourceData to OD. |
sam_grove |
0:6219434a0cb5 | 242 | * @param d Pointer to a CAN object data structure |
sam_grove |
0:6219434a0cb5 | 243 | * @param wIndex The index in the object dictionary where you want to write |
sam_grove |
0:6219434a0cb5 | 244 | * an entry |
sam_grove |
0:6219434a0cb5 | 245 | * @param bSubindex The subindex of the Index. e.g. mostly subindex 0 is |
sam_grove |
0:6219434a0cb5 | 246 | * used to tell you how many valid entries you can find |
sam_grove |
0:6219434a0cb5 | 247 | * in this index. Look at the canopen standard for further |
sam_grove |
0:6219434a0cb5 | 248 | * information |
sam_grove |
0:6219434a0cb5 | 249 | * @param *pSourceData Pointer to the variable that holds the value that should |
sam_grove |
0:6219434a0cb5 | 250 | * be copied into the object dictionary |
sam_grove |
0:6219434a0cb5 | 251 | * @param *pExpectedSize The size of the value (in Byte). |
sam_grove |
0:6219434a0cb5 | 252 | * @param checkAccess Flag that indicate if a check rights must be perfomed (0 : no , other than 0 : yes) |
sam_grove |
0:6219434a0cb5 | 253 | * @param endianize Data is not endianized and copied in machine native endianness |
sam_grove |
0:6219434a0cb5 | 254 | * @return |
sam_grove |
0:6219434a0cb5 | 255 | * - OD_SUCCESSFUL is returned upon success. |
sam_grove |
0:6219434a0cb5 | 256 | * - SDO abort code is returned if error occurs . (See file def.h) |
sam_grove |
0:6219434a0cb5 | 257 | * \n\n |
sam_grove |
0:6219434a0cb5 | 258 | * @code |
sam_grove |
0:6219434a0cb5 | 259 | * // Example usage: |
sam_grove |
0:6219434a0cb5 | 260 | * UNS8 B; |
sam_grove |
0:6219434a0cb5 | 261 | * B = 0xFF; // set transmission type |
sam_grove |
0:6219434a0cb5 | 262 | * |
sam_grove |
0:6219434a0cb5 | 263 | * retcode = writeLocalDict( (UNS16)0x1800, (UNS8)2, &B, sizeof(UNS8), 1 ); |
sam_grove |
0:6219434a0cb5 | 264 | * @endcode |
sam_grove |
0:6219434a0cb5 | 265 | */ |
sam_grove |
0:6219434a0cb5 | 266 | #define writeLocalDict( d, wIndex, bSubindex, pSourceData, pExpectedSize, checkAccess) \ |
sam_grove |
0:6219434a0cb5 | 267 | _setODentry( d, wIndex, bSubindex, pSourceData, pExpectedSize, checkAccess, 0) |
sam_grove |
0:6219434a0cb5 | 268 | |
sam_grove |
0:6219434a0cb5 | 269 | |
sam_grove |
0:6219434a0cb5 | 270 | |
sam_grove |
0:6219434a0cb5 | 271 | /** |
sam_grove |
0:6219434a0cb5 | 272 | * @brief Scan the index of object dictionary. Used only by setODentry and getODentry. |
sam_grove |
0:6219434a0cb5 | 273 | * @param *d Pointer to a CAN object data structure |
sam_grove |
0:6219434a0cb5 | 274 | * @param wIndex |
sam_grove |
0:6219434a0cb5 | 275 | * @param *errorCode : OD_SUCCESSFUL if index foundor SDO abort code. (See file def.h) |
sam_grove |
0:6219434a0cb5 | 276 | * @param **Callback |
sam_grove |
0:6219434a0cb5 | 277 | * @return NULL if index not found. Else : return the table part of the object dictionary. |
sam_grove |
0:6219434a0cb5 | 278 | */ |
sam_grove |
0:6219434a0cb5 | 279 | const indextable * scanIndexOD (CO_Data* d, UNS16 wIndex, UNS32 *errorCode, ODCallback_t **Callback); |
sam_grove |
0:6219434a0cb5 | 280 | |
sam_grove |
0:6219434a0cb5 | 281 | UNS32 RegisterSetODentryCallBack(CO_Data* d, UNS16 wIndex, UNS8 bSubindex, ODCallback_t Callback); |
sam_grove |
0:6219434a0cb5 | 282 | |
sam_grove |
0:6219434a0cb5 | 283 | #ifdef __cplusplus |
sam_grove |
0:6219434a0cb5 | 284 | } |
sam_grove |
0:6219434a0cb5 | 285 | #endif |
sam_grove |
0:6219434a0cb5 | 286 | |
sam_grove |
0:6219434a0cb5 | 287 | #endif /* __objacces_h__ */ |