NNP STM Generic Remote Module git-main
Loading...
Searching...
No Matches
sdo.h
Go to the documentation of this file.
1
8#ifndef INC_SDO_H_
9#define INC_SDO_H_
10
11#include "timer.h"
12
14
15typedef void (*SDOCallback_t)(CO_Data* d, UNS8 nodeId);
16
17/* The Transfer structure
18Used to store the different segments of
19 - a SDO received before writing in the dictionary
20 - the reading of the dictionary to put on a SDO to transmit
21*/
22
24{
29 UNS8 toggle;
33 UNS16 index;
34 UNS8 subIndex;
42 UNS8 data [SDO_MAX_LENGTH_TRANSFERT];
47 TIMER_HANDLE timer;
53 SDOCallback_t Callback;
55};
56typedef struct struct_s_transfer s_transfer;
57
58
59struct BODY{
61};
62
63/* The SDO structure ...*/
66 struct BODY body;
67};
68
69
70typedef struct struct_s_SDO s_SDO;
71
72
73void SDOTimeoutAlarm(CO_Data* d, UNS32 id);
74void resetSDO (CO_Data* d);
77UNS32 objdictToSDOBlockline (CO_Data* d, UNS8 line, UNS8 numberOfIndexes);
78UNS8 lineToSDO (CO_Data* d, UNS8 line, UNS32 nbBytes, UNS8 * data);
79UNS8 SDOtoLine (CO_Data* d, UNS8 line, UNS32 nbBytes, UNS8 * data);
80UNS8 failedSDO (CO_Data* d, UNS8 nodeId, UNS8 whoami, UNS16 index, UNS8 subIndex, UNS32 abortCode);
81void resetSDOline (CO_Data* d, UNS8 line);
82UNS8 initSDOline (CO_Data* d, UNS8 line, UNS8 nodeId, UNS16 index, UNS8 subIndex, UNS8 state);
83UNS8 getSDOfreeLine (CO_Data* d, UNS8 whoami, UNS8 *line);
84UNS8 getSDOlineOnUse (CO_Data* d, UNS8 nodeId, UNS8 whoami, UNS8 *line);
85UNS8 closeSDOtransfer (CO_Data* d, UNS8 nodeId, UNS8 whoami);
86UNS8 getSDOlineRestBytes (CO_Data* d, UNS8 line, UNS32 * nbBytes);
87UNS8 setSDOlineRestBytes (CO_Data* d, UNS8 line, UNS32 nbBytes);
88UNS8 sendSDO (CO_Data* d, UNS8 whoami, s_SDO sdo);
89UNS8 sendSDOabort (CO_Data* d, UNS8 whoami, UNS8 nodeId, UNS16 index, UNS8 subIndex, UNS32 abortCode);
92 UNS8 subIndex, UNS32 count, UNS8 dataType, void *data);
94 UNS8 subIndex, UNS32 count, UNS8 dataType, void *data, SDOCallback_t Callback);
96 UNS8 subIndex, UNS32 count, UNS8 dataType, void *data, SDOCallback_t Callback, UNS8 endianize);
97UNS8 readNetworkDict (CO_Data* d, UNS8 nodeId, UNS16 index, UNS8 subIndex, UNS8 dataType);
98UNS8 readBlockNetworkDict(CO_Data* d, UNS8 nodeId, UNS16 index, UNS8 subIndex, UNS8 size, UNS8 dataType );
99UNS8 readNetworkDictCallback (CO_Data* d, UNS8 nodeId, UNS16 index, UNS8 subIndex, UNS8 dataType, SDOCallback_t Callback);
100UNS8 readNetworkDictCallbackAI (CO_Data* d, UNS8 nodeId, UNS16 index, UNS8 subIndex, UNS8 dataType, SDOCallback_t Callback);
101UNS8 getReadResultNetworkDict (CO_Data* d, UNS8 nodeId, void* data, UNS32 *size, UNS32 * abortCode);
103
104
105#endif /* INC_SDO_H_ */
#define UNS8
Unsigned int8 representation in CANFest.
Definition applicfg.h:25
#define UNS16
Unsigned int16 representation in CANFest.
Definition applicfg.h:26
#define UNS32
Unsigned int32 representation in CANFest.
Definition applicfg.h:27
UNS32 objdictToSDOBlockline(CO_Data *d, UNS8 line, UNS8 numberOfIndexes)
Copy the data from the object dictionary to the SDO line for a network transfert.
Definition sdo.c:191
UNS8 readNetworkDict(CO_Data *d, UNS8 nodeId, UNS16 index, UNS8 subIndex, UNS8 dataType)
Used to send a SDO request frame to read.
Definition sdo.c:1936
void resetSDO(CO_Data *d)
Reset all SDO buffers.
Definition sdo.c:120
UNS8 failedSDO(CO_Data *d, UNS8 nodeId, UNS8 whoami, UNS16 index, UNS8 subIndex, UNS32 abortCode)
Called when an internal SDO abort occurs. Release the line * Only if server * If client,...
Definition sdo.c:326
UNS32 objdictToSDOline(CO_Data *d, UNS8 line)
Copy the data from the object dictionary to the SDO line for a network transfert.
Definition sdo.c:161
UNS8 lineToSDO(CO_Data *d, UNS8 line, UNS32 nbBytes, UNS8 *data)
Copy data from an existant line in the argument "* data".
Definition sdo.c:266
UNS32 SDOlineToObjdict(CO_Data *d, UNS8 line)
Copy the data received from the SDO line transfert to the object dictionary.
Definition sdo.c:136
UNS8 writeNetworkDictCallBackAI(CO_Data *d, UNS8 nodeId, UNS16 index, UNS8 subIndex, UNS32 count, UNS8 dataType, void *data, SDOCallback_t Callback, UNS8 endianize)
Used to send a SDO request frame to write in a distant node dictionnary.
Definition sdo.c:1635
UNS8 writeNetworkDictCallBack(CO_Data *d, UNS8 nodeId, UNS16 index, UNS8 subIndex, UNS32 count, UNS8 dataType, void *data, SDOCallback_t Callback)
Used to send a SDO request frame to write in a distant node dictionnary.
Definition sdo.c:1608
void resetSDOline(CO_Data *d, UNS8 line)
Reset an unused line.
Definition sdo.c:357
UNS8 readNetworkDictCallback(CO_Data *d, UNS8 nodeId, UNS16 index, UNS8 subIndex, UNS8 dataType, SDOCallback_t Callback)
Used to send a SDO request frame to read in a distant node dictionnary.
Definition sdo.c:1958
UNS8 getSDOfreeLine(CO_Data *d, UNS8 whoami, UNS8 *line)
Search for an unused line in the transfers array to store a new SDO. ie a line which value of the fie...
Definition sdo.c:412
UNS8 writeNetworkDict(CO_Data *d, UNS8 nodeId, UNS16 index, UNS8 subIndex, UNS32 count, UNS8 dataType, void *data)
Used to send a SDO request frame to write the data at the index and subIndex indicated.
Definition sdo.c:1583
UNS8 SDOtoLine(CO_Data *d, UNS8 line, UNS32 nbBytes, UNS8 *data)
Add data to an existant line.
Definition sdo.c:294
UNS8 readNetworkDictCallbackAI(CO_Data *d, UNS8 nodeId, UNS16 index, UNS8 subIndex, UNS8 dataType, SDOCallback_t Callback)
Used to send a SDO request frame to read in a distant node dictionnary.
Definition sdo.c:1979
UNS8 readBlockNetworkDict(CO_Data *d, UNS8 nodeId, UNS16 index, UNS8 subIndex, UNS8 size, UNS8 dataType)
Used to send a SDO request frame to read in a distant node dictionnary.
Definition sdo.c:1917
UNS8 getSDOlineRestBytes(CO_Data *d, UNS8 line, UNS32 *nbBytes)
Bytes in the line structure which must be transmited (or received)
Definition sdo.c:479
UNS8 setSDOlineRestBytes(CO_Data *d, UNS8 line, UNS32 nbBytes)
Store in the line structure the nb of bytes which must be transmited (or received)
Definition sdo.c:499
UNS8 getWriteResultNetworkDict(CO_Data *d, UNS8 nodeId, UNS32 *abortCode)
Use this function after calling writeNetworkDict function to get the result of the write.
Definition sdo.c:2120
void SDOTimeoutAlarm(CO_Data *d, UNS32 id)
Reset of a SDO exchange on timeout. Send a SDO abort.
Definition sdo.c:79
UNS8 getReadResultNetworkDict(CO_Data *d, UNS8 nodeId, void *data, UNS32 *size, UNS32 *abortCode)
Use this function after calling readNetworkDict to get the result.
Definition sdo.c:2054
UNS8 initSDOline(CO_Data *d, UNS8 line, UNS8 nodeId, UNS16 index, UNS8 subIndex, UNS8 state)
Initialize some fields of the structure.
Definition sdo.c:379
UNS8 getSDOlineOnUse(CO_Data *d, UNS8 nodeId, UNS8 whoami, UNS8 *line)
Search for the line, in the transfers array, which contains the beginning of the reception of a fragm...
Definition sdo.c:439
UNS8 sendSDOabort(CO_Data *d, UNS8 whoami, UNS8 nodeId, UNS16 index, UNS8 subIndex, UNS32 abortCode)
Transmit a SDO error to the client. The reasons may be : Read/Write to a undefined object Read/Write ...
Definition sdo.c:608
UNS8 sendSDO(CO_Data *d, UNS8 whoami, s_SDO sdo)
Transmit a SDO frame on the bus bus_id.
Definition sdo.c:517
UNS8 processSDO(CO_Data *d, Message *m)
Treat a SDO frame reception call the function sendSDO.
Definition sdo.c:649
Definition sdo.h:59
UNS8 data[8]
Definition sdo.h:60
Definition can.h:13
This structure contains all necessary informations to define a CANOpen node.
Definition data.h:44
UNS8 nodeId
Definition sdo.h:65
UNS32 abortCode
Definition sdo.h:30
UNS8 nodeId
Definition sdo.h:25
UNS32 count
Definition sdo.h:35
TIMER_HANDLE timer
Definition sdo.h:47
UNS8 whoami
Definition sdo.h:27
UNS8 dataType
Definition sdo.h:43
SDOCallback_t Callback
Definition sdo.h:53
UNS32 offset
Definition sdo.h:36