#include "canfestival.h"#include "sysdep.h"

Go to the source code of this file.
Defines | |
| #define | getSDOcs(byte) (byte >> 5) |
| #define | getSDOn2(byte) ((byte >> 2) & 3) |
| #define | getSDOn3(byte) ((byte >> 1) & 7) |
| #define | getSDOe(byte) ((byte >> 1) & 1) |
| #define | getSDOs(byte) (byte & 1) |
| #define | getSDOc(byte) (byte & 1) |
| #define | getSDOt(byte) ((byte >> 4) & 1) |
| #define | getSDOindex(byte1, byte2) ((byte2 << 8) | (byte1)) |
| #define | getSDOsubIndex(byte3) (byte3) |
Functions | |
| INLINE UNS8 | _writeNetworkDict (CO_Data *d, UNS8 nodeId, UNS16 index, UNS8 subIndex, UNS8 count, UNS8 dataType, void *data, SDOCallback_t Callback, UNS8 endianize) |
| void | SDOTimeoutAlarm (CO_Data *d, UNS32 id) |
| Reset of a SDO exchange on timeout. Send a SDO abort. | |
| void | resetSDO (CO_Data *d) |
| Reset all SDO buffers. | |
| UNS32 | SDOlineToObjdict (CO_Data *d, UNS8 line) |
| Copy the data received from the SDO line transfert to the object dictionary. | |
| UNS32 | objdictToSDOline (CO_Data *d, UNS8 line) |
| Copy the data from the object dictionary to the SDO line for a network transfert. | |
| UNS8 | lineToSDO (CO_Data *d, UNS8 line, UNS8 nbBytes, UNS8 *data) |
| Copy data from an existant line in the argument "* data". | |
| UNS8 | SDOtoLine (CO_Data *d, UNS8 line, UNS8 nbBytes, UNS8 *data) |
| Add data to an existant line. | |
| 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, the line must be released manually in the core application. The reason of that is to permit the program to read the transfers structure before its reset, because many informations are stored on it : index, subindex, data received or trasmited, ... In all cases, sends a SDO abort. | |
| void | resetSDOline (CO_Data *d, UNS8 line) |
| Reset an unused line. | |
| UNS8 | initSDOline (CO_Data *d, UNS8 line, UNS8 nodeId, UNS16 index, UNS8 subIndex, UNS8 state) |
| Initialize some fields of the structure. | |
| 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 field "state" is "SDO_RESET" An unused line have the field "state" at the value SDO_RESET. | |
| 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 fragmented SDO. | |
| UNS8 | closeSDOtransfer (CO_Data *d, UNS8 nodeId, UNS8 whoami) |
| Close a transmission. | |
| UNS8 | getSDOlineRestBytes (CO_Data *d, UNS8 line, UNS8 *nbBytes) |
| Bytes in the line structure which must be transmited (or received). | |
| UNS8 | setSDOlineRestBytes (CO_Data *d, UNS8 line, UNS8 nbBytes) |
| Store in the line structure the nb of bytes which must be transmited (or received). | |
| UNS8 | sendSDO (CO_Data *d, UNS8 whoami, s_SDO sdo) |
| Transmit a SDO frame on the bus bus_id. | |
| 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 to a undefined subindex Read/write a not valid length object Write a read only object. | |
| UNS8 | proceedSDO (CO_Data *d, Message *m) |
| Treat a SDO frame reception call the function sendSDO. | |
| UNS8 | writeNetworkDict (CO_Data *d, UNS8 nodeId, UNS16 index, UNS8 subIndex, UNS8 count, UNS8 dataType, void *data) |
| Used to send a SDO request frame to write the data at the index and subIndex indicated. | |
| UNS8 | writeNetworkDictCallBack (CO_Data *d, UNS8 nodeId, UNS16 index, UNS8 subIndex, UNS8 count, UNS8 dataType, void *data, SDOCallback_t Callback) |
| Used to send a SDO request frame to write in a distant node dictionnary. | |
| UNS8 | writeNetworkDictCallBackAI (CO_Data *d, UNS8 nodeId, UNS16 index, UNS8 subIndex, UNS8 count, UNS8 dataType, void *data, SDOCallback_t Callback, UNS8 endianize) |
| Used to send a SDO request frame to write in a distant node dictionnary. | |
| UNS8 | readNetworkDict (CO_Data *d, UNS8 nodeId, UNS16 index, UNS8 subIndex, UNS8 dataType) |
| Used to send a SDO request frame to read. | |
| 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. | |
| 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. | |
| UNS8 | getReadResultNetworkDict (CO_Data *d, UNS8 nodeId, void *data, UNS8 *size, UNS32 *abortCode) |
| Use this function after calling readNetworkDict to get the result. | |
| UNS8 | getWriteResultNetworkDict (CO_Data *d, UNS8 nodeId, UNS32 *abortCode) |
| Use this function after calling writeNetworkDict function to get the result of the write. | |
Definition in file sdo.c.
| #define getSDOc | ( | byte | ) | (byte & 1) |
Returns the indicator of end transmission from the first byte of the SDO
Definition at line 81 of file sdo.c.
Referenced by proceedSDO().
| #define getSDOcs | ( | byte | ) | (byte >> 5) |
Returns the command specifier (cs, ccs, scs) from the first byte of the SDO
Definition at line 61 of file sdo.c.
Referenced by proceedSDO().
| #define getSDOe | ( | byte | ) | ((byte >> 1) & 1) |
Returns the transfer type from the first byte of the SDO
Definition at line 73 of file sdo.c.
Referenced by proceedSDO().
| #define getSDOindex | ( | byte1, | |||
| byte2 | ) | ((byte2 << 8) | (byte1)) |
Returns the index from the bytes 1 and 2 of the SDO
Definition at line 89 of file sdo.c.
Referenced by proceedSDO().
| #define getSDOn2 | ( | byte | ) | ((byte >> 2) & 3) |
Returns the number of bytes without data from the first byte of the SDO. Coded in 2 bits
Definition at line 65 of file sdo.c.
Referenced by proceedSDO().
| #define getSDOn3 | ( | byte | ) | ((byte >> 1) & 7) |
Returns the number of bytes without data from the first byte of the SDO. Coded in 3 bits
Definition at line 69 of file sdo.c.
Referenced by proceedSDO().
| #define getSDOs | ( | byte | ) | (byte & 1) |
Returns the size indicator from the first byte of the SDO
Definition at line 77 of file sdo.c.
Referenced by proceedSDO().
| #define getSDOsubIndex | ( | byte3 | ) | (byte3) |
Returns the subIndex from the byte 3 of the SDO
Definition at line 93 of file sdo.c.
Referenced by proceedSDO().
| #define getSDOt | ( | byte | ) | ((byte >> 4) & 1) |
Returns the toggle from the first byte of the SDO
Definition at line 85 of file sdo.c.
Referenced by proceedSDO().
| INLINE UNS8 _writeNetworkDict | ( | CO_Data * | d, | |
| UNS8 | nodeId, | |||
| UNS16 | index, | |||
| UNS8 | subIndex, | |||
| UNS8 | count, | |||
| UNS8 | dataType, | |||
| void * | data, | |||
| SDOCallback_t | Callback, | |||
| UNS8 | endianize | |||
| ) |
| d | ||
| nodeId | ||
| index | ||
| subIndex | ||
| count | ||
| dataType | ||
| data | ||
| Callback | ||
| endianize |
Normal transfert
Definition at line 1223 of file sdo.c.
References struct_CO_Data::firstIndex, getSDOfreeLine(), getSDOlineOnUse(), initSDOline(), struct_CO_Data::lastIndex, struct_CO_Data::objdict, resetSDOline(), sendSDO(), and struct_CO_Data::transfers.
Referenced by writeNetworkDict(), writeNetworkDictCallBack(), and writeNetworkDictCallBackAI().

| UNS8 closeSDOtransfer | ( | CO_Data * | d, | |
| UNS8 | nodeId, | |||
| UNS8 | whoami | |||
| ) |
Close a transmission.
| d | ||
| nodeId | ||
| whoami |
Definition at line 405 of file sdo.c.
References getSDOlineOnUse(), and resetSDOline().

| 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, the line must be released manually in the core application. The reason of that is to permit the program to read the transfers structure before its reset, because many informations are stored on it : index, subindex, data received or trasmited, ... In all cases, sends a SDO abort.
| d | ||
| nodeId | ||
| whoami | ||
| index | ||
| subIndex | ||
| abortCode |
Definition at line 271 of file sdo.c.
References getSDOlineOnUse(), resetSDOline(), sendSDOabort(), and struct_CO_Data::transfers.
Referenced by proceedSDO().

| 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 field "state" is "SDO_RESET" An unused line have the field "state" at the value SDO_RESET.
| d | ||
| whoami | ||
| line |
Definition at line 354 of file sdo.c.
References struct_CO_Data::transfers.
Referenced by _writeNetworkDict(), and proceedSDO().
| 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 fragmented SDO.
| d | ||
| nodeId | ||
| whoami | ||
| line |
Definition at line 380 of file sdo.c.
References struct_CO_Data::transfers.
Referenced by _writeNetworkDict(), closeSDOtransfer(), failedSDO(), getReadResultNetworkDict(), getWriteResultNetworkDict(), and proceedSDO().
| UNS8 getSDOlineRestBytes | ( | CO_Data * | d, | |
| UNS8 | line, | |||
| UNS8 * | nbBytes | |||
| ) |
Bytes in the line structure which must be transmited (or received).
| d | ||
| line | ||
| nbBytes |
Definition at line 427 of file sdo.c.
References struct_CO_Data::transfers.
Referenced by proceedSDO().
| UNS8 initSDOline | ( | CO_Data * | d, | |
| UNS8 | line, | |||
| UNS8 | nodeId, | |||
| UNS16 | index, | |||
| UNS8 | subIndex, | |||
| UNS8 | state | |||
| ) |
Initialize some fields of the structure.
| d | ||
| line | ||
| nodeId | ||
| index | ||
| subIndex | ||
| state |
Definition at line 325 of file sdo.c.
References struct_CO_Data::transfers.
Referenced by _writeNetworkDict(), proceedSDO(), and resetSDOline().
| UNS8 lineToSDO | ( | CO_Data * | d, | |
| UNS8 | line, | |||
| UNS8 | nbBytes, | |||
| UNS8 * | data | |||
| ) |
Copy data from an existant line in the argument "* data".
| d | ||
| line | ||
| nbBytes | ||
| data |
Definition at line 214 of file sdo.c.
References struct_CO_Data::transfers.
Referenced by proceedSDO().
| UNS32 objdictToSDOline | ( | CO_Data * | d, | |
| UNS8 | line | |||
| ) |
Copy the data from the object dictionary to the SDO line for a network transfert.
| d | ||
| line |
Definition at line 181 of file sdo.c.
References getODentry, and struct_CO_Data::transfers.
Referenced by proceedSDO().
Treat a SDO frame reception call the function sendSDO.
| d | ||
| m |
The server node Id;
The server node Id;
Definition at line 585 of file sdo.c.
References struct_CO_Data::bDeviceNodeId, Message::cob_id, Message::data, failedSDO(), struct_CO_Data::firstIndex, getSDOc, getSDOcs, getSDOe, getSDOfreeLine(), getSDOindex, getSDOlineOnUse(), getSDOlineRestBytes(), getSDOn2, getSDOn3, getSDOs, getSDOsubIndex, getSDOt, initSDOline(), struct_CO_Data::lastIndex, lineToSDO(), struct_CO_Data::objdict, objdictToSDOline(), resetSDOline(), SDOlineToObjdict(), SDOtoLine(), sendSDO(), setSDOlineRestBytes(), and struct_CO_Data::transfers.

| void resetSDO | ( | CO_Data * | d | ) |
Reset all SDO buffers.
Reset all sdo buffers
| d |
Definition at line 141 of file sdo.c.
References resetSDOline().

| void resetSDOline | ( | CO_Data * | d, | |
| UNS8 | line | |||
| ) |
Reset an unused line.
| d | ||
| line |
Definition at line 302 of file sdo.c.
References initSDOline(), and struct_CO_Data::transfers.
Referenced by _writeNetworkDict(), closeSDOtransfer(), failedSDO(), proceedSDO(), resetSDO(), and SDOTimeoutAlarm().

| UNS32 SDOlineToObjdict | ( | CO_Data * | d, | |
| UNS8 | line | |||
| ) |
Copy the data received from the SDO line transfert to the object dictionary.
| d | ||
| line |
Definition at line 158 of file sdo.c.
References setODentry, and struct_CO_Data::transfers.
Referenced by proceedSDO().
| void SDOTimeoutAlarm | ( | CO_Data * | d, | |
| UNS32 | id | |||
| ) |
Reset of a SDO exchange on timeout. Send a SDO abort.
| d | ||
| id |
Definition at line 101 of file sdo.c.
References resetSDOline(), sendSDOabort(), and struct_CO_Data::transfers.

| UNS8 SDOtoLine | ( | CO_Data * | d, | |
| UNS8 | line, | |||
| UNS8 | nbBytes, | |||
| UNS8 * | data | |||
| ) |
Add data to an existant line.
| d | ||
| line | ||
| nbBytes | ||
| data |
Definition at line 243 of file sdo.c.
References struct_CO_Data::transfers.
Referenced by proceedSDO().
| UNS8 sendSDO | ( | CO_Data * | d, | |
| UNS8 | whoami, | |||
| s_SDO | sdo | |||
| ) |
Transmit a SDO frame on the bus bus_id.
| d | ||
| whoami | ||
| sdo |
Definition at line 464 of file sdo.c.
References struct_CO_Data::canHandle, Message::cob_id, Message::data, struct_CO_Data::firstIndex, struct_CO_Data::lastIndex, Message::len, struct_CO_Data::nodeState, struct_CO_Data::objdict, and Message::rtr.
Referenced by _writeNetworkDict(), proceedSDO(), and sendSDOabort().
| 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 to a undefined subindex Read/write a not valid length object Write a read only object.
| d | ||
| whoami | ||
| index | ||
| subIndex | ||
| abortCode |
Definition at line 544 of file sdo.c.
References struct_CO_Data::bDeviceNodeId, and sendSDO().
Referenced by failedSDO(), and SDOTimeoutAlarm().

| UNS8 setSDOlineRestBytes | ( | CO_Data * | d, | |
| UNS8 | line, | |||
| UNS8 | nbBytes | |||
| ) |
Store in the line structure the nb of bytes which must be transmited (or received).
| d | ||
| line | ||
| nbBytes |
Definition at line 445 of file sdo.c.
References struct_CO_Data::transfers.
Referenced by proceedSDO().
1.5.6