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