author | Edouard Tisserant |
Tue, 20 Mar 2018 16:04:52 +0100 | |
changeset 800 | f0d16976e46e |
parent 694 | 8dd1e58b3815 |
child 801 | 32d146b64a35 |
permissions | -rw-r--r-- |
0 | 1 |
/* |
506
c17e2e17aca8
Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents:
499
diff
changeset
|
2 |
This file is part of CanFestival, a library implementing CanOpen Stack. |
0 | 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 |
||
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
23 |
/** @defgroup comobj Communication Objects |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
24 |
* @ingroup userapi |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
25 |
*/ |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
26 |
|
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
27 |
/** @defgroup sdo Service Data Object (SDO) |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
28 |
* SDOs provide the access to entries in the CANopen Object Dictionary. |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
29 |
* An SDO is made up of at least two CAN messages with different identifiers. |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
30 |
* SDO s are always confirmed point-to-point communications services. |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
31 |
* @ingroup comobj |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
32 |
*/ |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
33 |
|
0 | 34 |
#ifndef __sdo_h__ |
35 |
#define __sdo_h__ |
|
36 |
||
37 |
struct struct_s_transfer; |
|
38 |
||
39 |
#include "timer.h" |
|
40 |
||
664
a03f0aa7d219
CHANGE: SDO block mode added, without CRC support
fbeaulier
parents:
663
diff
changeset
|
41 |
/* Block mode : Data consumer receive step |
a03f0aa7d219
CHANGE: SDO block mode added, without CRC support
fbeaulier
parents:
663
diff
changeset
|
42 |
* - set to RXSTEP_STARTED when client receive initiate upload response |
a03f0aa7d219
CHANGE: SDO block mode added, without CRC support
fbeaulier
parents:
663
diff
changeset
|
43 |
* - set to RXSTEP_END when last segment of a block received |
a03f0aa7d219
CHANGE: SDO block mode added, without CRC support
fbeaulier
parents:
663
diff
changeset
|
44 |
*/ |
a03f0aa7d219
CHANGE: SDO block mode added, without CRC support
fbeaulier
parents:
663
diff
changeset
|
45 |
typedef enum {RXSTEP_INIT, RXSTEP_STARTED, RXSTEP_END } rxStep_t; |
a03f0aa7d219
CHANGE: SDO block mode added, without CRC support
fbeaulier
parents:
663
diff
changeset
|
46 |
|
32 | 47 |
typedef void (*SDOCallback_t)(CO_Data* d, UNS8 nodeId); |
48 |
||
0 | 49 |
/* The Transfer structure |
506
c17e2e17aca8
Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents:
499
diff
changeset
|
50 |
Used to store the different segments of |
c17e2e17aca8
Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents:
499
diff
changeset
|
51 |
- a SDO received before writing in the dictionary |
c17e2e17aca8
Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents:
499
diff
changeset
|
52 |
- the reading of the dictionary to put on a SDO to transmit |
664
a03f0aa7d219
CHANGE: SDO block mode added, without CRC support
fbeaulier
parents:
663
diff
changeset
|
53 |
WARNING : after a change in this structure check the macro s_transfer_Initializer in data.h |
0 | 54 |
*/ |
55 |
||
56 |
struct struct_s_transfer { |
|
663 | 57 |
UNS8 CliServNbr; /**< The index of the SDO client / server in our OD minus 0x1280 / 0x1200 */ |
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
58 |
|
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
59 |
UNS8 whoami; /**< Takes the values SDO_CLIENT or SDO_SERVER */ |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
60 |
UNS8 state; /**< state of the transmission : Takes the values SDO_... */ |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
61 |
UNS8 toggle; |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
62 |
UNS32 abortCode; /**< Sent or received */ |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
63 |
/**< index and subindex of the dictionary where to store */ |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
64 |
/**< (for a received SDO) or to read (for a transmit SDO) */ |
506
c17e2e17aca8
Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents:
499
diff
changeset
|
65 |
UNS16 index; |
c17e2e17aca8
Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents:
499
diff
changeset
|
66 |
UNS8 subIndex; |
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
67 |
UNS32 count; /**< Number of data received or to be sent. */ |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
68 |
UNS32 offset; /**< stack pointer of data[] |
71 | 69 |
* Used only to tranfer part of a line to or from a SDO. |
70 |
* offset is always pointing on the next free cell of data[]. |
|
506
c17e2e17aca8
Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents:
499
diff
changeset
|
71 |
* WARNING s_transfer.data is subject to ENDIANISATION |
71 | 72 |
* (with respect to CANOPEN_BIG_ENDIAN) |
73 |
*/ |
|
694
8dd1e58b3815
There is no English word "transfert". Fix all the typos.
JaFojtik
parents:
664
diff
changeset
|
74 |
UNS8 data [SDO_MAX_LENGTH_TRANSFER]; |
636
033fe6f1ec3c
ADDED: - dynamic memory allocation for sdo transfer using malloc and free
Christian Taedcke
parents:
561
diff
changeset
|
75 |
#ifdef SDO_DYNAMIC_BUFFER_ALLOCATION |
033fe6f1ec3c
ADDED: - dynamic memory allocation for sdo transfer using malloc and free
Christian Taedcke
parents:
561
diff
changeset
|
76 |
UNS8 *dynamicData; |
033fe6f1ec3c
ADDED: - dynamic memory allocation for sdo transfer using malloc and free
Christian Taedcke
parents:
561
diff
changeset
|
77 |
UNS32 dynamicDataSize; |
033fe6f1ec3c
ADDED: - dynamic memory allocation for sdo transfer using malloc and free
Christian Taedcke
parents:
561
diff
changeset
|
78 |
#endif //SDO_DYNAMIC_BUFFER_ALLOCATION |
664
a03f0aa7d219
CHANGE: SDO block mode added, without CRC support
fbeaulier
parents:
663
diff
changeset
|
79 |
|
a03f0aa7d219
CHANGE: SDO block mode added, without CRC support
fbeaulier
parents:
663
diff
changeset
|
80 |
UNS8 peerCRCsupport; /**< True if peer supports CRC */ |
a03f0aa7d219
CHANGE: SDO block mode added, without CRC support
fbeaulier
parents:
663
diff
changeset
|
81 |
UNS8 blksize; /**< Number of segments per block with 0 < blksize < 128 */ |
a03f0aa7d219
CHANGE: SDO block mode added, without CRC support
fbeaulier
parents:
663
diff
changeset
|
82 |
UNS8 ackseq; /**< sequence number of last segment that was received successfully */ |
a03f0aa7d219
CHANGE: SDO block mode added, without CRC support
fbeaulier
parents:
663
diff
changeset
|
83 |
UNS32 objsize; /**< Size in bytes of the object provided by data producer */ |
a03f0aa7d219
CHANGE: SDO block mode added, without CRC support
fbeaulier
parents:
663
diff
changeset
|
84 |
UNS8 lastblockoffset; /**< Value of offset before last block */ |
a03f0aa7d219
CHANGE: SDO block mode added, without CRC support
fbeaulier
parents:
663
diff
changeset
|
85 |
UNS8 seqno; /**< Last sequence number received OK or transmitted */ |
a03f0aa7d219
CHANGE: SDO block mode added, without CRC support
fbeaulier
parents:
663
diff
changeset
|
86 |
UNS8 endfield; /**< nbr of bytes in last segment of last block that do not contain data */ |
a03f0aa7d219
CHANGE: SDO block mode added, without CRC support
fbeaulier
parents:
663
diff
changeset
|
87 |
rxStep_t rxstep; /**< data consumer receive step - set to true when last segment of a block received */ |
a03f0aa7d219
CHANGE: SDO block mode added, without CRC support
fbeaulier
parents:
663
diff
changeset
|
88 |
UNS8 tmpData[8]; /**< temporary segment storage */ |
a03f0aa7d219
CHANGE: SDO block mode added, without CRC support
fbeaulier
parents:
663
diff
changeset
|
89 |
|
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
90 |
UNS8 dataType; /**< Defined in objdictdef.h Value is visible_string |
506
c17e2e17aca8
Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents:
499
diff
changeset
|
91 |
* if it is a string, any other value if it is not a string, |
71 | 92 |
* like 0. In fact, it is used only if client. |
93 |
*/ |
|
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
94 |
TIMER_HANDLE timer; /**< Time counter to implement a timeout in milliseconds. |
506
c17e2e17aca8
Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents:
499
diff
changeset
|
95 |
* It is automatically incremented whenever |
c17e2e17aca8
Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents:
499
diff
changeset
|
96 |
* the line state is in SDO_DOWNLOAD_IN_PROGRESS or |
c17e2e17aca8
Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents:
499
diff
changeset
|
97 |
* SDO_UPLOAD_IN_PROGRESS, and reseted to 0 |
74 | 98 |
* when the response SDO have been received. |
71 | 99 |
*/ |
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
100 |
SDOCallback_t Callback; /**< The user callback func to be called at SDO transaction end */ |
0 | 101 |
}; |
102 |
typedef struct struct_s_transfer s_transfer; |
|
506
c17e2e17aca8
Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents:
499
diff
changeset
|
103 |
|
0 | 104 |
|
105 |
#include "data.h" |
|
106 |
||
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
107 |
/** |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
108 |
* @brief Reset of a SDO exchange on timeout. |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
109 |
* Send a SDO abort. |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
110 |
* @param *d Pointer on a CAN object data structure |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
111 |
* @param id |
53 | 112 |
*/ |
113 |
void SDOTimeoutAlarm(CO_Data* d, UNS32 id); |
|
114 |
||
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
115 |
/** |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
116 |
* @brief Reset all SDO buffers. |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
117 |
* @param *d Pointer on a CAN object data structure |
0 | 118 |
*/ |
119 |
void resetSDO (CO_Data* d); |
|
120 |
||
121 |
||
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
122 |
/** |
694
8dd1e58b3815
There is no English word "transfert". Fix all the typos.
JaFojtik
parents:
664
diff
changeset
|
123 |
* @brief Copy the data received from the SDO line transfer to the object dictionary. |
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
124 |
* @param *d Pointer on a CAN object data structure |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
125 |
* @param line SDO line |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
126 |
* @return SDO error code if error. Else, returns 0. |
0 | 127 |
*/ |
128 |
UNS32 SDOlineToObjdict (CO_Data* d, UNS8 line); |
|
129 |
||
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
130 |
/** |
694
8dd1e58b3815
There is no English word "transfert". Fix all the typos.
JaFojtik
parents:
664
diff
changeset
|
131 |
* @brief Copy the data from the object dictionary to the SDO line for a network transfer. |
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
132 |
* @param *d Pointer on a CAN object data structure |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
133 |
* @param line SDO line |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
134 |
* @return SDO error code if error. Else, returns 0. |
0 | 135 |
*/ |
136 |
UNS32 objdictToSDOline (CO_Data* d, UNS8 line); |
|
137 |
||
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
138 |
/** |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
139 |
* @brief Copy data from an existant line in the argument "* data" |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
140 |
* @param d Pointer on a CAN object data structure |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
141 |
* @param line SDO line |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
142 |
* @param nbBytes |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
143 |
* @param *data Pointer on the data |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
144 |
* @return 0xFF if error. Else, returns 0. |
0 | 145 |
*/ |
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
|
146 |
UNS8 lineToSDO (CO_Data* d, UNS8 line, UNS32 nbBytes, UNS8 * data); |
0 | 147 |
|
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
148 |
/** |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
149 |
* @brief Add data to an existant line |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
150 |
* @param d Pointer on a CAN object data structure |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
151 |
* @param line SDO line |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
152 |
* @param nbBytes |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
153 |
* @param *data Pointer on the data |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
154 |
* @return 0xFF if error. Else, returns 0. |
0 | 155 |
*/ |
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
|
156 |
UNS8 SDOtoLine (CO_Data* d, UNS8 line, UNS32 nbBytes, UNS8 * data); |
0 | 157 |
|
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
158 |
/** |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
159 |
* @brief Called when an internal SDO abort occurs. |
506
c17e2e17aca8
Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents:
499
diff
changeset
|
160 |
* Release the line * Only if server * |
0 | 161 |
* If client, the line must be released manually in the core application. |
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
162 |
* The reason of that is to permit the program to read the transfers structure before its reset, |
0 | 163 |
* because many informations are stored on it : index, subindex, data received or trasmited, ... |
164 |
* In all cases, sends a SDO abort. |
|
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
165 |
* @param *d Pointer on a CAN object data structure |
663 | 166 |
* @param CliServNbr |
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
167 |
* @param whoami |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
168 |
* @param index |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
169 |
* @param subIndex |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
170 |
* @param abortCode |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
171 |
* @return 0 |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
172 |
*/ |
663 | 173 |
UNS8 failedSDO (CO_Data* d, UNS8 CliServNbr, UNS8 whoami, UNS16 index, UNS8 subIndex, UNS32 abortCode); |
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
174 |
|
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
175 |
/** |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
176 |
* @brief Reset an unused line. |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
177 |
* @param *d Pointer on a CAN object data structure |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
178 |
* @param line SDO line |
0 | 179 |
*/ |
180 |
void resetSDOline (CO_Data* d, UNS8 line); |
|
181 |
||
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
182 |
/** |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
183 |
* @brief Initialize some fields of the structure. |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
184 |
* @param *d Pointer on a CAN object data structure |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
185 |
* @param line |
663 | 186 |
* @param CliServNbr |
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
187 |
* @param index |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
188 |
* @param subIndex |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
189 |
* @param state |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
190 |
* @return 0 |
0 | 191 |
*/ |
663 | 192 |
UNS8 initSDOline (CO_Data* d, UNS8 line, UNS8 CliServNbr, UNS16 index, UNS8 subIndex, UNS8 state); |
0 | 193 |
|
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
194 |
/** |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
195 |
* @brief Search for an unused line in the transfers array |
0 | 196 |
* to store a new SDO. |
197 |
* ie a line which value of the field "state" is "SDO_RESET" |
|
198 |
* An unused line have the field "state" at the value SDO_RESET |
|
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
199 |
* @param *d Pointer on a CAN object data structure |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
200 |
* @param whoami Create the line for a SDO_SERVER or SDO_CLIENT. |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
201 |
* @param *line Pointer on a SDO line |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
202 |
* @return 0xFF if all the lines are on use. Else, return 0. |
0 | 203 |
*/ |
204 |
UNS8 getSDOfreeLine (CO_Data* d, UNS8 whoami, UNS8 *line); |
|
205 |
||
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
206 |
/** |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
207 |
* @brief Search for the line, in the transfers array, which contains the |
0 | 208 |
* beginning of the reception of a fragmented SDO |
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
209 |
* @param *d Pointer on a CAN object data structure |
663 | 210 |
* @param CliServNbr Client or Server object involved |
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
211 |
* @param whoami takes 2 values : look for a line opened as SDO_CLIENT or SDO_SERVER |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
212 |
* @param *line Pointer on a SDO line |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
213 |
* @return 0xFF if error. Else, return 0 |
0 | 214 |
*/ |
663 | 215 |
UNS8 getSDOlineOnUse (CO_Data* d, UNS8 CliServNbr, UNS8 whoami, UNS8 *line); |
0 | 216 |
|
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
217 |
/** |
656
f923456f01e5
FIXED: - Sdo lines with the internal state SDO_ABORTED_ITERNAL are now closed.
Christian Taedcke
parents:
636
diff
changeset
|
218 |
* @brief Search for the line, in the transfers array, which contains the |
f923456f01e5
FIXED: - Sdo lines with the internal state SDO_ABORTED_ITERNAL are now closed.
Christian Taedcke
parents:
636
diff
changeset
|
219 |
* beginning of the reception of a fragmented SDO |
f923456f01e5
FIXED: - Sdo lines with the internal state SDO_ABORTED_ITERNAL are now closed.
Christian Taedcke
parents:
636
diff
changeset
|
220 |
* |
f923456f01e5
FIXED: - Sdo lines with the internal state SDO_ABORTED_ITERNAL are now closed.
Christian Taedcke
parents:
636
diff
changeset
|
221 |
* Because getSDOlineOnUse() does not return any line in state \c SDO_ABORTED_INTERNAL, |
f923456f01e5
FIXED: - Sdo lines with the internal state SDO_ABORTED_ITERNAL are now closed.
Christian Taedcke
parents:
636
diff
changeset
|
222 |
* this funtion is used to return them, too. |
f923456f01e5
FIXED: - Sdo lines with the internal state SDO_ABORTED_ITERNAL are now closed.
Christian Taedcke
parents:
636
diff
changeset
|
223 |
* |
f923456f01e5
FIXED: - Sdo lines with the internal state SDO_ABORTED_ITERNAL are now closed.
Christian Taedcke
parents:
636
diff
changeset
|
224 |
* @param *d Pointer on a CAN object data structure |
663 | 225 |
* @param CliServNbr Client or Server object involved |
656
f923456f01e5
FIXED: - Sdo lines with the internal state SDO_ABORTED_ITERNAL are now closed.
Christian Taedcke
parents:
636
diff
changeset
|
226 |
* @param whoami takes 2 values : look for a line opened as SDO_CLIENT or SDO_SERVER |
f923456f01e5
FIXED: - Sdo lines with the internal state SDO_ABORTED_ITERNAL are now closed.
Christian Taedcke
parents:
636
diff
changeset
|
227 |
* @param *line Pointer on a SDO line |
f923456f01e5
FIXED: - Sdo lines with the internal state SDO_ABORTED_ITERNAL are now closed.
Christian Taedcke
parents:
636
diff
changeset
|
228 |
* @return 0xFF if error. Else, return 0 |
f923456f01e5
FIXED: - Sdo lines with the internal state SDO_ABORTED_ITERNAL are now closed.
Christian Taedcke
parents:
636
diff
changeset
|
229 |
*/ |
663 | 230 |
UNS8 getSDOlineToClose (CO_Data* d, UNS8 CliServNbr, UNS8 whoami, UNS8 *line); |
656
f923456f01e5
FIXED: - Sdo lines with the internal state SDO_ABORTED_ITERNAL are now closed.
Christian Taedcke
parents:
636
diff
changeset
|
231 |
|
f923456f01e5
FIXED: - Sdo lines with the internal state SDO_ABORTED_ITERNAL are now closed.
Christian Taedcke
parents:
636
diff
changeset
|
232 |
/** |
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
233 |
* @brief Close a transmission. |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
234 |
* @param *d Pointer on a CAN object data structure |
663 | 235 |
* @param CliServNbr Client or Server object involved |
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
236 |
* @param whoami Line opened as SDO_CLIENT or SDO_SERVER |
0 | 237 |
*/ |
663 | 238 |
UNS8 closeSDOtransfer (CO_Data* d, UNS8 CliServNbr, UNS8 whoami); |
0 | 239 |
|
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
240 |
/** |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
241 |
* @brief Bytes in the line structure which must be transmited (or received) |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
242 |
* @param *d Pointer on a CAN object data structure |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
243 |
* @param line SDO line |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
244 |
* @param *nbBytes Pointer on nbBytes |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
245 |
* @return 0. |
0 | 246 |
*/ |
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
|
247 |
UNS8 getSDOlineRestBytes (CO_Data* d, UNS8 line, UNS32 * nbBytes); |
0 | 248 |
|
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
249 |
/** |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
250 |
* @brief Store in the line structure the nb of bytes which must be transmited (or received) |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
251 |
* @param *d Pointer on a CAN object data structure |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
252 |
* @param line SDO line |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
253 |
* @param nbBytes |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
254 |
* @return 0 if success, 0xFF if error. |
0 | 255 |
*/ |
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
|
256 |
UNS8 setSDOlineRestBytes (CO_Data* d, UNS8 line, UNS32 nbBytes); |
0 | 257 |
|
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
258 |
/** |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
259 |
* @brief Transmit a SDO frame on the bus bus_id |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
260 |
* @param *d Pointer on a CAN object data structure |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
261 |
* @param whoami Takes 2 values : SDO_CLIENT or SDO_SERVER |
663 | 262 |
* @param CliServNbr Client or Server object involved |
263 |
* @param data Array of the 8 bytes to transmit |
|
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
264 |
* @return canSend(bus_id,&m) or 0xFF if error. |
0 | 265 |
*/ |
663 | 266 |
UNS8 sendSDO (CO_Data* d, UNS8 whoami, UNS8 CliServNbr, UNS8 *pData); |
0 | 267 |
|
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
268 |
/** |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
269 |
* @brief Transmit a SDO error to the client. The reasons may be : |
0 | 270 |
* Read/Write to a undefined object |
271 |
* Read/Write to a undefined subindex |
|
272 |
* Read/write a not valid length object |
|
273 |
* Write a read only object |
|
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
274 |
* @param *d Pointer on a CAN object data structure |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
275 |
* @param whoami takes 2 values : SDO_CLIENT or SDO_SERVER |
663 | 276 |
* @param CliServNbr |
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
277 |
* @param index |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
278 |
* @param subIndex |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
279 |
* @param abortCode |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
280 |
* @return 0 |
0 | 281 |
*/ |
663 | 282 |
UNS8 sendSDOabort (CO_Data* d, UNS8 whoami, UNS8 CliServNbr, UNS16 index, UNS8 subIndex, UNS32 abortCode); |
0 | 283 |
|
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
284 |
/** |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
285 |
* @brief Treat a SDO frame reception |
0 | 286 |
* call the function sendSDO |
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
287 |
* @param *d Pointer on a CAN object data structure |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
288 |
* @param *m Pointer on a CAN message structure |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
289 |
* @return code : |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
290 |
* - 0xFF if error |
694
8dd1e58b3815
There is no English word "transfert". Fix all the typos.
JaFojtik
parents:
664
diff
changeset
|
291 |
* - 0x80 if transfer aborted by the server |
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
292 |
* - 0x0 ok |
0 | 293 |
*/ |
294 |
UNS8 proceedSDO (CO_Data* d, Message *m); |
|
295 |
||
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
296 |
/** |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
297 |
* @ingroup sdo |
561 | 298 |
* @brief Used to send a SDO request frame to write the data at the index and subIndex indicated |
299 |
* @param *d Pointer to a CAN object data structure |
|
300 |
* @param nodeId Node Id of the slave |
|
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
301 |
* @param index At index indicated |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
302 |
* @param subIndex At subIndex indicated |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
303 |
* @param count number of bytes to write in the dictionnary. |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
304 |
* @param dataType (defined in objdictdef.h) : put "visible_string" for strings, 0 for integers or reals or other value. |
561 | 305 |
* @param *data Pointer to data |
306 |
* @return |
|
307 |
* - 0 is returned upon success. |
|
308 |
* - 0xFE is returned when no sdo client to communicate with node. |
|
309 |
* - 0xFF is returned when error occurs. |
|
0 | 310 |
*/ |
506
c17e2e17aca8
Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents:
499
diff
changeset
|
311 |
UNS8 writeNetworkDict (CO_Data* d, UNS8 nodeId, UNS16 index, |
664
a03f0aa7d219
CHANGE: SDO block mode added, without CRC support
fbeaulier
parents:
663
diff
changeset
|
312 |
UNS8 subIndex, UNS32 count, UNS8 dataType, void *data, UNS8 useBlockMode); |
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
313 |
|
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
314 |
/** |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
315 |
* @ingroup sdo |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
316 |
* @brief Used to send a SDO request frame to write in a distant node dictionnary. |
561 | 317 |
* @details The function Callback which must be defined in the user code is called at the |
53 | 318 |
* end of the exchange. (on succes or abort). |
561 | 319 |
* @param *d Pointer to a CAN object data structure |
320 |
* @param nodeId Node Id of the slave |
|
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
321 |
* @param index At index indicated |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
322 |
* @param subIndex At subIndex indicated |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
323 |
* @param count number of bytes to write in the dictionnary. |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
324 |
* @param dataType (defined in objdictdef.h) : put "visible_string" for strings, 0 for integers or reals or other value. |
561 | 325 |
* @param *data Pointer to data |
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
326 |
* @param Callback Callback function |
561 | 327 |
* @return |
328 |
* - 0 is returned upon success. |
|
329 |
* - 0xFE is returned when no sdo client to communicate with node. |
|
330 |
* - 0xFF is returned when error occurs. |
|
506
c17e2e17aca8
Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents:
499
diff
changeset
|
331 |
*/ |
c17e2e17aca8
Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents:
499
diff
changeset
|
332 |
UNS8 writeNetworkDictCallBack (CO_Data* d, UNS8 nodeId, UNS16 index, |
664
a03f0aa7d219
CHANGE: SDO block mode added, without CRC support
fbeaulier
parents:
663
diff
changeset
|
333 |
UNS8 subIndex, UNS32 count, UNS8 dataType, void *data, SDOCallback_t Callback, UNS8 useBlockMode); |
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
334 |
|
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
335 |
/** |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
336 |
* @ingroup sdo |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
337 |
* @brief Used to send a SDO request frame to write in a distant node dictionnary. |
561 | 338 |
* @details The function Callback which must be defined in the user code is called at the |
506
c17e2e17aca8
Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents:
499
diff
changeset
|
339 |
* end of the exchange. (on succes or abort). First free SDO client parameter is |
c17e2e17aca8
Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents:
499
diff
changeset
|
340 |
* automatically initialized for specific node if not already defined. |
561 | 341 |
* @param *d Pointer to a CAN object data structure |
342 |
* @param nodeId Node Id of the slave |
|
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
343 |
* @param index At index indicated |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
344 |
* @param subIndex At subIndex indicated |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
345 |
* @param count number of bytes to write in the dictionnary. |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
346 |
* @param dataType (defined in objdictdef.h) : put "visible_string" for strings, 0 for integers or reals or other value. |
561 | 347 |
* @param *data Pointer to data |
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
348 |
* @param Callback Callback function |
529
c171e11707c5
Second time, Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
528
diff
changeset
|
349 |
* @param endianize When not 0, data is endianized into network byte order |
c171e11707c5
Second time, Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
528
diff
changeset
|
350 |
* when 0, data is not endianized and copied in machine native |
c171e11707c5
Second time, Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
528
diff
changeset
|
351 |
* endianness |
561 | 352 |
* @return |
353 |
* - 0 is returned upon success. |
|
354 |
* - 0xFF is returned when error occurs. |
|
506
c17e2e17aca8
Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents:
499
diff
changeset
|
355 |
*/ |
c17e2e17aca8
Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents:
499
diff
changeset
|
356 |
UNS8 writeNetworkDictCallBackAI (CO_Data* d, UNS8 nodeId, UNS16 index, |
664
a03f0aa7d219
CHANGE: SDO block mode added, without CRC support
fbeaulier
parents:
663
diff
changeset
|
357 |
UNS8 subIndex, UNS32 count, UNS8 dataType, void *data, SDOCallback_t Callback, UNS8 endianize, UNS8 useBlockMode); |
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
358 |
|
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
359 |
/** |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
360 |
* @ingroup sdo |
561 | 361 |
* @brief Used to send a SDO request frame to read. |
362 |
* @param *d Pointer to a CAN object data structure |
|
363 |
* @param nodeId Node Id of the slave |
|
364 |
* @param index At index indicated |
|
365 |
* @param subIndex At subIndex indicated |
|
366 |
* @param dataType (defined in objdictdef.h) : put "visible_string" for strings, 0 for integers or reals or other value. |
|
367 |
* @return |
|
368 |
* - 0 is returned upon success. |
|
369 |
* - 0xFE is returned when no sdo client to communicate with node. |
|
370 |
* - 0xFF is returned when error occurs. |
|
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
371 |
*/ |
664
a03f0aa7d219
CHANGE: SDO block mode added, without CRC support
fbeaulier
parents:
663
diff
changeset
|
372 |
UNS8 readNetworkDict (CO_Data* d, UNS8 nodeId, UNS16 index, UNS8 subIndex, UNS8 dataType, UNS8 useBlockMode); |
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
373 |
|
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
374 |
/** |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
375 |
* @ingroup sdo |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
376 |
* @brief Used to send a SDO request frame to read in a distant node dictionnary. |
561 | 377 |
* @details The function Callback which must be defined in the user code is called at the |
53 | 378 |
* end of the exchange. (on succes or abort). |
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
379 |
* @param *d Pointer on a CAN object data structure |
561 | 380 |
* @param nodeId Node Id of the slave |
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
381 |
* @param index At index indicated |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
382 |
* @param subIndex At subIndex indicated |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
383 |
* @param dataType (defined in objdictdef.h) : put "visible_string" for strings, 0 for integers or reals or other value. |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
384 |
* @param Callback Callback function |
561 | 385 |
* @return |
386 |
* - 0 is returned upon success. |
|
387 |
* - 0xFE is returned when no sdo client to communicate with node. |
|
388 |
* - 0xFF is returned when error occurs. |
|
506
c17e2e17aca8
Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents:
499
diff
changeset
|
389 |
*/ |
664
a03f0aa7d219
CHANGE: SDO block mode added, without CRC support
fbeaulier
parents:
663
diff
changeset
|
390 |
UNS8 readNetworkDictCallback (CO_Data* d, UNS8 nodeId, UNS16 index, UNS8 subIndex, UNS8 dataType, SDOCallback_t Callback, UNS8 useBlockMode); |
0 | 391 |
|
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
392 |
/** |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
393 |
* @ingroup sdo |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
394 |
* @brief Used to send a SDO request frame to read in a distant node dictionnary. |
561 | 395 |
* @details The function Callback which must be defined in the user code is called at the |
506
c17e2e17aca8
Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents:
499
diff
changeset
|
396 |
* end of the exchange. (on succes or abort). First free SDO client parameter is |
c17e2e17aca8
Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents:
499
diff
changeset
|
397 |
* automatically initialized for specific node if not already defined. |
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
398 |
* @param *d Pointer on a CAN object data structure |
561 | 399 |
* @param nodeId Node Id of the slave |
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
400 |
* @param index At index indicated |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
401 |
* @param subIndex At subIndex indicated |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
402 |
* @param dataType (defined in objdictdef.h) : put "visible_string" for strings, 0 for integers or reals or other value. |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
403 |
* @param Callback Callback function |
561 | 404 |
* @return |
405 |
* - 0 is returned upon success. |
|
406 |
* - 0xFF is returned when error occurs. |
|
506
c17e2e17aca8
Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents:
499
diff
changeset
|
407 |
*/ |
664
a03f0aa7d219
CHANGE: SDO block mode added, without CRC support
fbeaulier
parents:
663
diff
changeset
|
408 |
UNS8 readNetworkDictCallbackAI (CO_Data* d, UNS8 nodeId, UNS16 index, UNS8 subIndex, UNS8 dataType, SDOCallback_t Callback, UNS8 useBlockMode); |
506
c17e2e17aca8
Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents:
499
diff
changeset
|
409 |
|
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
410 |
/** |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
411 |
* @ingroup sdo |
561 | 412 |
* @brief Use this function after calling readNetworkDict to get the result. |
413 |
* |
|
414 |
* @param *d Pointer to a CAN object data structure |
|
415 |
* @param nodeId Node Id of the slave |
|
664
a03f0aa7d219
CHANGE: SDO block mode added, without CRC support
fbeaulier
parents:
663
diff
changeset
|
416 |
* @param *data Pointer to the buffer to get the data |
a03f0aa7d219
CHANGE: SDO block mode added, without CRC support
fbeaulier
parents:
663
diff
changeset
|
417 |
* @param *size Pointer to the size : MUST contain the size of the buffer before calling |
a03f0aa7d219
CHANGE: SDO block mode added, without CRC support
fbeaulier
parents:
663
diff
changeset
|
418 |
* The function set it to the actual number of written bytes |
561 | 419 |
* @param *abortCode Pointer to the abortcode. (0 = not available. Else : SDO abort code. (received if return SDO_ABORTED_RCV) |
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
420 |
* |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
421 |
* |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
422 |
* @return |
561 | 423 |
* - SDO_FINISHED // datas are available |
694
8dd1e58b3815
There is no English word "transfert". Fix all the typos.
JaFojtik
parents:
664
diff
changeset
|
424 |
* - SDO_ABORTED_RCV // Transfer failed (abort SDO received) |
8dd1e58b3815
There is no English word "transfert". Fix all the typos.
JaFojtik
parents:
664
diff
changeset
|
425 |
* - SDO_ABORTED_INTERNAL // Transfer failed (internal abort) |
561 | 426 |
* - SDO_UPLOAD_IN_PROGRESS // Datas are not yet available |
427 |
* - SDO_DOWNLOAD_IN_PROGRESS // Download is in progress |
|
664
a03f0aa7d219
CHANGE: SDO block mode added, without CRC support
fbeaulier
parents:
663
diff
changeset
|
428 |
* - SDO_PROVIDED_BUFFER_TOO_SMALL //The value *size is not enough to store the received data |
561 | 429 |
* \n\n |
430 |
* example : |
|
529
c171e11707c5
Second time, Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
528
diff
changeset
|
431 |
* @code |
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
432 |
* UNS32 data; |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
433 |
* UNS8 size; |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
434 |
* readNetworkDict(0, 0x05, 0x1016, 1, 0) // get the data index 1016 subindex 1 of node 5 |
561 | 435 |
* while (getReadResultNetworkDict (0, 0x05, &data, &size) == SDO_UPLOAD_IN_PROGRESS); |
529
c171e11707c5
Second time, Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
528
diff
changeset
|
436 |
* @endcode |
0 | 437 |
*/ |
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
|
438 |
UNS8 getReadResultNetworkDict (CO_Data* d, UNS8 nodeId, void* data, UNS32 *size, UNS32 * abortCode); |
0 | 439 |
|
440 |
/** |
|
561 | 441 |
* @ingroup sdo |
442 |
* @brief Use this function after calling writeNetworkDict function to get the result of the write. |
|
443 |
* @details It is mandatory to call this function because it is releasing the line used for the transfer. |
|
444 |
* @param *d Pointer to a CAN object data structure |
|
445 |
* @param nodeId Node Id of the slave |
|
446 |
* @param *abortCode Pointer to the abortcode |
|
447 |
* - 0 = not available. |
|
448 |
* - SDO abort code (received if return SDO_ABORTED_RCV) |
|
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
449 |
* |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
450 |
* @return : |
561 | 451 |
* - SDO_FINISHED // datas are available |
694
8dd1e58b3815
There is no English word "transfert". Fix all the typos.
JaFojtik
parents:
664
diff
changeset
|
452 |
* - SDO_ABORTED_RCV // Transfer failed (abort SDO received) |
8dd1e58b3815
There is no English word "transfert". Fix all the typos.
JaFojtik
parents:
664
diff
changeset
|
453 |
* - SDO_ABORTED_INTERNAL // Transfer failed (Internal abort) |
561 | 454 |
* - SDO_DOWNLOAD_IN_PROGRESS // Datas are not yet available |
455 |
* - SDO_UPLOAD_IN_PROGRESS // Upload in progress |
|
456 |
* \n\n |
|
457 |
* example : |
|
529
c171e11707c5
Second time, Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
528
diff
changeset
|
458 |
* @code |
528
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
459 |
* UNS32 data = 0x50; |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
460 |
* UNS8 size; |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
461 |
* UNS32 abortCode; |
0a30e161d63c
Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
506
diff
changeset
|
462 |
* writeNetworkDict(0, 0x05, 0x1016, 1, size, &data) // write the data index 1016 subindex 1 of node 5 |
561 | 463 |
* while (getWriteResultNetworkDict (0, 0x05, &abortCode) == SDO_DOWNLOAD_IN_PROGRESS); |
529
c171e11707c5
Second time, Re-write doxygen tags in headers files to generate User API documentation
greg
parents:
528
diff
changeset
|
464 |
* @endcode |
0 | 465 |
*/ |
466 |
UNS8 getWriteResultNetworkDict (CO_Data* d, UNS8 nodeId, UNS32 * abortCode); |
|
467 |
||
468 |
#endif |