author | etisserant |
Tue, 13 Feb 2007 16:36:44 +0100 | |
changeset 91 | ed2612282988 |
parent 75 | debc68b124b7 |
child 161 | c4908cc776a9 |
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); |
|
40 |
||
41 |
#include "data.h" |
|
42 |
||
43 |
||
44 |
||
71 | 45 |
/* |
0 | 46 |
Print MSG_WAR (s) if error to the access to the object dictionary occurs. |
71 | 47 |
You must uncomment the lines |
0 | 48 |
//#define DEBUG_CAN |
49 |
//#define DEBUG_WAR_CONSOLE_ON |
|
50 |
//#define DEBUG_ERR_CONSOLE_ON |
|
71 | 51 |
in the file objaccess.c |
0 | 52 |
sizeDataDict : Size of the data defined in the dictionary |
53 |
sizeDataGiven : Size data given by the user. |
|
54 |
code : error code to print. (SDO abort code. See file def.h) |
|
55 |
Beware that sometimes, we force the sizeDataDict or sizeDataGiven to 0, when we wants to use |
|
56 |
this function but we do not have the access to the right value. One example is |
|
57 |
getSDOerror(). So do not take attention to these variables if they are null. |
|
58 |
*/ |
|
75
debc68b124b7
compiler compatibility : accessDictionaryError contains nothing out of debogue mode
frdupin
parents:
71
diff
changeset
|
59 |
|
0 | 60 |
UNS8 accessDictionaryError(UNS16 index, UNS8 subIndex, |
61 |
UNS8 sizeDataDict, UNS8 sizeDataGiven, UNS32 code); |
|
75
debc68b124b7
compiler compatibility : accessDictionaryError contains nothing out of debogue mode
frdupin
parents:
71
diff
changeset
|
62 |
|
0 | 63 |
|
71 | 64 |
/* Reads an entry from the object dictionary.\n |
0 | 65 |
* \code |
66 |
* // Example usage: |
|
67 |
* UNS8 *pbData; |
|
68 |
* UNS8 length; |
|
69 |
* UNS32 returnValue; |
|
70 |
* |
|
71 |
* returnValue = getODentry( (UNS16)0x100B, (UNS8)1, |
|
72 |
* (void * *)&pbData, (UNS8 *)&length ); |
|
73 |
* if( returnValue != SUCCESSFUL ) |
|
74 |
* { |
|
75 |
* // error handling |
|
76 |
* } |
|
77 |
* \endcode |
|
78 |
* \param wIndex The index in the object dictionary where you want to read |
|
79 |
* an entry |
|
80 |
* \param bSubindex The subindex of the Index. e.g. mostly subindex 0 is |
|
81 |
* used to tell you how many valid entries you can find |
|
82 |
* in this index. Look at the canopen standard for further |
|
83 |
* information |
|
84 |
* \param ppbData Pointer to the pointer which points to the variable where |
|
85 |
* the value of this object dictionary entry should be copied |
|
86 |
* \param pdwSize This function writes the size of the copied value (in Byte) |
|
87 |
* into this variable. |
|
88 |
* \param pDataType : The type of the data. See objdictdef.h |
|
89 |
* \param CheckAccess if other than 0, do not read if the data is Write Only |
|
90 |
* [Not used today. Put always 0]. |
|
91 |
* \return OD_SUCCESSFUL or SDO abort code. (See file def.h) |
|
92 |
*/ |
|
93 |
UNS32 getODentry( CO_Data* d, |
|
94 |
UNS16 wIndex, |
|
95 |
UNS8 bSubindex, |
|
96 |
void * pDestData, |
|
97 |
UNS8 * pExpectedSize, |
|
98 |
UNS8 * pDataType, |
|
99 |
UNS8 checkAccess); |
|
100 |
||
101 |
||
71 | 102 |
/* By this function you can write an entry into the object dictionary\n |
0 | 103 |
* \code |
104 |
* // Example usage: |
|
105 |
* UNS8 B; |
|
106 |
* B = 0xFF; // set transmission type |
|
107 |
* |
|
108 |
* retcode = setODentry( (UNS16)0x1800, (UNS8)2, &B, sizeof(UNS8), 1 ); |
|
109 |
* \endocde |
|
110 |
* \param wIndex The index in the object dictionary where you want to write |
|
111 |
* an entry |
|
112 |
* \param bSubindex The subindex of the Index. e.g. mostly subindex 0 is |
|
113 |
* used to tell you how many valid entries you can find |
|
114 |
* in this index. Look at the canopen standard for further |
|
115 |
* information |
|
116 |
* \param pbData Pointer to the variable that holds the value that should |
|
117 |
* be copied into the object dictionary |
|
118 |
* \param dwSize The size of the value (in Byte). |
|
119 |
* \param CheckAccess if other than 0, do not read if the data is Read Only or Constant |
|
120 |
* \return OD_SUCCESSFUL or SDO abort code. (See file def.h) |
|
121 |
*/ |
|
122 |
UNS32 setODentry( CO_Data* d, |
|
123 |
UNS16 wIndex, |
|
124 |
UNS8 bSubindex, |
|
125 |
void * pSourceData, |
|
126 |
UNS8 * pExpectedSize, |
|
127 |
UNS8 checkAccess); |
|
128 |
||
129 |
||
71 | 130 |
/* Scan the index of object dictionary. Used only by setODentry and getODentry. |
0 | 131 |
* *errorCode : OD_SUCCESSFUL if index foundor SDO abort code. (See file def.h) |
132 |
* Return NULL if index not found. Else : return the table part of the object dictionary. |
|
133 |
*/ |
|
134 |
const indextable * scanIndexOD (CO_Data* d, UNS16 wIndex, UNS32 *errorCode, ODCallback_t **Callback); |
|
135 |
||
136 |
UNS32 RegisterSetODentryCallBack(CO_Data* d, UNS16 wIndex, UNS8 bSubindex, ODCallback_t Callback); |
|
137 |
||
71 | 138 |
#endif /* __objacces_h__ */ |