author | etisserant |
Fri, 08 Feb 2008 14:52:48 +0100 | |
changeset 385 | fff25f16c923 |
parent 378 | d2abf6c8c27b |
child 469 | f2b07ea215b5 |
permissions | -rw-r--r-- |
0 | 1 |
/* |
2 |
This file is part of CanFestival, a library implementing CanOpen Stack. |
|
3 |
||
4 |
Copyright (C): Edouard TISSERANT and Francis DUPIN |
|
5 |
||
6 |
See COPYING file for copyrights details. |
|
7 |
||
8 |
This library is free software; you can redistribute it and/or |
|
9 |
modify it under the terms of the GNU Lesser General Public |
|
10 |
License as published by the Free Software Foundation; either |
|
11 |
version 2.1 of the License, or (at your option) any later version. |
|
12 |
||
13 |
This library is distributed in the hope that it will be useful, |
|
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
16 |
Lesser General Public License for more details. |
|
17 |
||
18 |
You should have received a copy of the GNU Lesser General Public |
|
19 |
License along with this library; if not, write to the Free Software |
|
20 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
21 |
*/ |
|
22 |
||
23 |
/** \file |
|
24 |
* \brief Responsible for accessing the object dictionary. |
|
25 |
* |
|
26 |
* This file contains functions for accessing the object dictionary and |
|
27 |
* variables that are contained by the object dictionary. |
|
28 |
* Accessing the object dictionary contains setting local variables |
|
29 |
* as PDOs and accessing (read/write) all entries of the object dictionary |
|
30 |
* \warning Only the basic entries of an object dictionary are included |
|
31 |
* at the moment. |
|
32 |
*/ |
|
33 |
||
34 |
#ifndef __objacces_h__ |
|
35 |
#define __objacces_h__ |
|
36 |
||
37 |
#include <applicfg.h> |
|
38 |
||
39 |
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
|
40 |
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
|
41 |
void _storeODSubIndex (CO_Data* d, UNS16 wIndex, UNS8 bSubindex); |
0 | 42 |
|
71 | 43 |
/* |
0 | 44 |
Print MSG_WAR (s) if error to the access to the object dictionary occurs. |
71 | 45 |
You must uncomment the lines |
0 | 46 |
//#define DEBUG_CAN |
47 |
//#define DEBUG_WAR_CONSOLE_ON |
|
48 |
//#define DEBUG_ERR_CONSOLE_ON |
|
71 | 49 |
in the file objaccess.c |
0 | 50 |
sizeDataDict : Size of the data defined in the dictionary |
51 |
sizeDataGiven : Size data given by the user. |
|
52 |
code : error code to print. (SDO abort code. See file def.h) |
|
53 |
Beware that sometimes, we force the sizeDataDict or sizeDataGiven to 0, when we wants to use |
|
54 |
this function but we do not have the access to the right value. One example is |
|
55 |
getSDOerror(). So do not take attention to these variables if they are null. |
|
56 |
*/ |
|
75
debc68b124b7
compiler compatibility : accessDictionaryError contains nothing out of debogue mode
frdupin
parents:
71
diff
changeset
|
57 |
|
0 | 58 |
UNS8 accessDictionaryError(UNS16 index, UNS8 subIndex, |
59 |
UNS8 sizeDataDict, UNS8 sizeDataGiven, UNS32 code); |
|
75
debc68b124b7
compiler compatibility : accessDictionaryError contains nothing out of debogue mode
frdupin
parents:
71
diff
changeset
|
60 |
|
0 | 61 |
|
71 | 62 |
/* Reads an entry from the object dictionary.\n |
0 | 63 |
* \code |
64 |
* // Example usage: |
|
65 |
* UNS8 *pbData; |
|
66 |
* UNS8 length; |
|
67 |
* UNS32 returnValue; |
|
68 |
* |
|
69 |
* returnValue = getODentry( (UNS16)0x100B, (UNS8)1, |
|
70 |
* (void * *)&pbData, (UNS8 *)&length ); |
|
71 |
* if( returnValue != SUCCESSFUL ) |
|
72 |
* { |
|
73 |
* // error handling |
|
74 |
* } |
|
75 |
* \endcode |
|
76 |
* \param wIndex The index in the object dictionary where you want to read |
|
77 |
* an entry |
|
78 |
* \param bSubindex The subindex of the Index. e.g. mostly subindex 0 is |
|
79 |
* used to tell you how many valid entries you can find |
|
80 |
* in this index. Look at the canopen standard for further |
|
81 |
* information |
|
82 |
* \param ppbData Pointer to the pointer which points to the variable where |
|
83 |
* the value of this object dictionary entry should be copied |
|
84 |
* \param pdwSize This function writes the size of the copied value (in Byte) |
|
85 |
* into this variable. |
|
86 |
* \param pDataType : The type of the data. See objdictdef.h |
|
87 |
* \param CheckAccess if other than 0, do not read if the data is Write Only |
|
88 |
* [Not used today. Put always 0]. |
|
89 |
* \return OD_SUCCESSFUL or SDO abort code. (See file def.h) |
|
90 |
*/ |
|
91 |
UNS32 getODentry( CO_Data* d, |
|
92 |
UNS16 wIndex, |
|
93 |
UNS8 bSubindex, |
|
94 |
void * pDestData, |
|
95 |
UNS8 * pExpectedSize, |
|
96 |
UNS8 * pDataType, |
|
97 |
UNS8 checkAccess); |
|
98 |
||
99 |
||
71 | 100 |
/* By this function you can write an entry into the object dictionary\n |
0 | 101 |
* \code |
102 |
* // Example usage: |
|
103 |
* UNS8 B; |
|
104 |
* B = 0xFF; // set transmission type |
|
105 |
* |
|
106 |
* retcode = setODentry( (UNS16)0x1800, (UNS8)2, &B, sizeof(UNS8), 1 ); |
|
107 |
* \endocde |
|
108 |
* \param wIndex The index in the object dictionary where you want to write |
|
109 |
* an entry |
|
110 |
* \param bSubindex The subindex of the Index. e.g. mostly subindex 0 is |
|
111 |
* used to tell you how many valid entries you can find |
|
112 |
* in this index. Look at the canopen standard for further |
|
113 |
* information |
|
114 |
* \param pbData Pointer to the variable that holds the value that should |
|
115 |
* be copied into the object dictionary |
|
116 |
* \param dwSize The size of the value (in Byte). |
|
117 |
* \param CheckAccess if other than 0, do not read if the data is Read Only or Constant |
|
118 |
* \return OD_SUCCESSFUL or SDO abort code. (See file def.h) |
|
119 |
*/ |
|
120 |
UNS32 setODentry( CO_Data* d, |
|
121 |
UNS16 wIndex, |
|
122 |
UNS8 bSubindex, |
|
123 |
void * pSourceData, |
|
124 |
UNS8 * pExpectedSize, |
|
125 |
UNS8 checkAccess); |
|
126 |
||
175
e255529b6f7d
Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents:
161
diff
changeset
|
127 |
/*The same, without endianisation*/ |
e255529b6f7d
Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents:
161
diff
changeset
|
128 |
UNS32 writeLocalDict( CO_Data* d, |
e255529b6f7d
Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents:
161
diff
changeset
|
129 |
UNS16 wIndex, |
e255529b6f7d
Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents:
161
diff
changeset
|
130 |
UNS8 bSubindex, |
e255529b6f7d
Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents:
161
diff
changeset
|
131 |
void * pSourceData, |
e255529b6f7d
Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents:
161
diff
changeset
|
132 |
UNS8 * pExpectedSize, |
e255529b6f7d
Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents:
161
diff
changeset
|
133 |
UNS8 checkAccess); |
e255529b6f7d
Added writeLocalDict and readLocalDict, that have to be called from application instead of getODEntry and setODEntry. Fix potential endianization problem.
etisserant
parents:
161
diff
changeset
|
134 |
|
0 | 135 |
|
71 | 136 |
/* Scan the index of object dictionary. Used only by setODentry and getODentry. |
0 | 137 |
* *errorCode : OD_SUCCESSFUL if index foundor SDO abort code. (See file def.h) |
138 |
* Return NULL if index not found. Else : return the table part of the object dictionary. |
|
139 |
*/ |
|
140 |
const indextable * scanIndexOD (CO_Data* d, UNS16 wIndex, UNS32 *errorCode, ODCallback_t **Callback); |
|
141 |
||
142 |
UNS32 RegisterSetODentryCallBack(CO_Data* d, UNS16 wIndex, UNS8 bSubindex, ODCallback_t Callback); |
|
143 |
||
71 | 144 |
#endif /* __objacces_h__ */ |