CANopenNode
CANopen protocol stack
Loading...
Searching...
No Matches
CO_SDOclient.h
Go to the documentation of this file.
1
22#ifndef CO_SDO_CLIENT_H
23#define CO_SDO_CLIENT_H
24
25#include "301/CO_driver.h"
26#include "301/CO_ODinterface.h"
27#include "301/CO_SDOserver.h"
28#include "301/CO_fifo.h"
29
30/* default configuration, see CO_config.h */
31#ifndef CO_CONFIG_SDO_CLI
32#define CO_CONFIG_SDO_CLI (0)
33#endif
34
35#ifndef CO_DOXYGEN
36#ifndef CO_CONFIG_SDO_CLI_BUFFER_SIZE
37#if ((CO_CONFIG_SDO_CLI)&CO_CONFIG_SDO_CLI_BLOCK) != 0
38#define CO_CONFIG_SDO_CLI_BUFFER_SIZE 1000U
39#else
40#define CO_CONFIG_SDO_CLI_BUFFER_SIZE 32U
41#endif
42#endif
43#endif
44
45#if (((CO_CONFIG_SDO_CLI)&CO_CONFIG_SDO_CLI_ENABLE) != 0) || defined CO_DOXYGEN
46
47#ifdef __cplusplus
48extern "C" {
49#endif
50
151typedef struct {
152#if (((CO_CONFIG_SDO_CLI)&CO_CONFIG_SDO_CLI_LOCAL) != 0) || defined CO_DOXYGEN
156#endif
162#if (((CO_CONFIG_SDO_CLI)&CO_CONFIG_FLAG_OD_DYNAMIC) != 0) || defined CO_DOXYGEN
163
170#endif
176 size_t sizeInd;
178 size_t sizeTran;
185 volatile void* CANrxNew;
187 uint8_t CANrxData[8];
188#if (((CO_CONFIG_SDO_CLI)&CO_CONFIG_FLAG_CALLBACK_PRE) != 0) || defined CO_DOXYGEN
189 void (*pFunctSignal)(void* object);
191#endif
192#if (((CO_CONFIG_SDO_CLI)&CO_CONFIG_SDO_CLI_SEGMENTED) != 0) || defined CO_DOXYGEN
194#endif
195#if (((CO_CONFIG_SDO_CLI)&CO_CONFIG_SDO_CLI_BLOCK) != 0) || defined CO_DOXYGEN
202 uint8_t block_dataUploadLast[7];
204#endif
206
229 CO_CANmodule_t* CANdevRx, uint16_t CANdevRxIdx, CO_CANmodule_t* CANdevTx,
230 uint16_t CANdevTxIdx, uint32_t* errInfo);
231
232#if (((CO_CONFIG_SDO_CLI)&CO_CONFIG_FLAG_CALLBACK_PRE) != 0) || defined CO_DOXYGEN
244void CO_SDOclient_initCallbackPre(CO_SDOclient_t* SDOclient, void* object, void (*pFunctSignal)(void* object));
245#endif
246
262CO_SDO_return_t CO_SDOclient_setup(CO_SDOclient_t* SDO_C, uint32_t COB_IDClientToServer, uint32_t COB_IDServerToClient,
263 uint8_t nodeIDOfTheSDOServer);
264
286 size_t sizeIndicated, uint16_t SDOtimeoutTime_ms, bool_t blockEnable);
287
298void CO_SDOclientDownloadInitSize(CO_SDOclient_t* SDO_C, size_t sizeIndicated);
299
317size_t CO_SDOclientDownloadBufWrite(CO_SDOclient_t* SDO_C, const uint8_t* buf, size_t count);
318
342 bool_t bufferPartial, CO_SDO_abortCode_t* SDOabortCode, size_t* sizeTransferred,
343 uint32_t* timerNext_us);
344
360 uint16_t SDOtimeoutTime_ms, bool_t blockEnable);
361
386 CO_SDO_abortCode_t* SDOabortCode, size_t* sizeIndicated, size_t* sizeTransferred,
387 uint32_t* timerNext_us);
388
407size_t CO_SDOclientUploadBufRead(CO_SDOclient_t* SDO_C, uint8_t* buf, size_t count);
408
418
419 /* CO_SDOclient */
420
421#ifdef __cplusplus
422}
423#endif /* __cplusplus */
424
425#endif /* (CO_CONFIG_SDO_CLI) & CO_CONFIG_SDO_CLI_ENABLE */
426
427#endif /* CO_SDO_CLIENT_H */
CANopen Object Dictionary interface.
CANopen Service Data Object - server protocol.
Interface between CAN hardware and CANopenNode.
FIFO circular buffer.
CO_SDO_return_t CO_SDOclientDownload(CO_SDOclient_t *SDO_C, uint32_t timeDifference_us, bool_t send_abort, bool_t bufferPartial, CO_SDO_abortCode_t *SDOabortCode, size_t *sizeTransferred, uint32_t *timerNext_us)
Process SDO download communication.
CO_SDO_return_t CO_SDOclientUploadInitiate(CO_SDOclient_t *SDO_C, uint16_t index, uint8_t subIndex, uint16_t SDOtimeoutTime_ms, bool_t blockEnable)
Initiate SDO upload communication.
CO_SDO_return_t CO_SDOclientDownloadInitiate(CO_SDOclient_t *SDO_C, uint16_t index, uint8_t subIndex, size_t sizeIndicated, uint16_t SDOtimeoutTime_ms, bool_t blockEnable)
Initiate SDO download communication.
void CO_SDOclient_initCallbackPre(CO_SDOclient_t *SDOclient, void *object, void(*pFunctSignal)(void *object))
Initialize SDOclient callback function.
size_t CO_SDOclientDownloadBufWrite(CO_SDOclient_t *SDO_C, const uint8_t *buf, size_t count)
Write data into SDO client buffer.
void CO_SDOclientClose(CO_SDOclient_t *SDO_C)
Close SDO communication temporary.
void CO_SDOclientDownloadInitSize(CO_SDOclient_t *SDO_C, size_t sizeIndicated)
Initiate SDO download communication - update size.
size_t CO_SDOclientUploadBufRead(CO_SDOclient_t *SDO_C, uint8_t *buf, size_t count)
Read data from SDO client buffer.
CO_SDO_return_t CO_SDOclientUpload(CO_SDOclient_t *SDO_C, uint32_t timeDifference_us, bool_t send_abort, CO_SDO_abortCode_t *SDOabortCode, size_t *sizeIndicated, size_t *sizeTransferred, uint32_t *timerNext_us)
Process SDO upload communication.
CO_SDO_return_t CO_SDOclient_setup(CO_SDOclient_t *SDO_C, uint32_t COB_IDClientToServer, uint32_t COB_IDServerToClient, uint8_t nodeIDOfTheSDOServer)
Setup SDO client object.
CO_ReturnError_t CO_SDOclient_init(CO_SDOclient_t *SDO_C, OD_t *OD, OD_entry_t *OD_1280_SDOcliPar, uint8_t nodeId, CO_CANmodule_t *CANdevRx, uint16_t CANdevRxIdx, CO_CANmodule_t *CANdevTx, uint16_t CANdevTxIdx, uint32_t *errInfo)
Initialize SDO client object.
CO_SDO_state_t
Internal states of the SDO state machine.
Definition CO_SDOserver.h:90
CO_SDO_abortCode_t
SDO abort codes.
Definition CO_SDOserver.h:296
CO_SDO_return_t
Return values from SDO server or client functions.
Definition CO_SDOserver.h:341
#define CO_CONFIG_SDO_CLI_BUFFER_SIZE
Size of the internal data buffer for the SDO client.
Definition CO_config.h:415
unsigned int uint16_t
UNSIGNED16 in CANopen (0006h), 16-bit unsigned integer.
Definition CO_driver.h:132
unsigned long int uint32_t
UNSIGNED32 in CANopen (0007h), 32-bit unsigned integer.
Definition CO_driver.h:133
uint_fast8_t bool_t
Boolean data type for general use.
Definition CO_driver.h:126
unsigned char uint8_t
UNSIGNED8 in CANopen (0005h), 8-bit unsigned integer.
Definition CO_driver.h:131
CO_ReturnError_t
Return values of some CANopen functions.
Definition CO_driver.h:449
Complete CAN module object.
Definition CO_driver.h:268
Configuration object for CAN transmit message for specific CANopenNode Object.
Definition CO_driver.h:250
SDO client object.
Definition CO_SDOclient.h:151
uint8_t nodeId
From CO_SDOclient_init()
Definition CO_SDOclient.h:154
OD_IO_t OD_IO
Object dictionary interface for locally transferred object.
Definition CO_SDOclient.h:155
size_t sizeInd
Size of data, which will be transferred.
Definition CO_SDOclient.h:176
bool_t valid
If true, SDO channel is valid.
Definition CO_SDOclient.h:172
uint8_t block_noData
Number of bytes in last segment that do not contain data.
Definition CO_SDOclient.h:200
uint16_t CANdevTxIdx
From CO_SDOclient_init()
Definition CO_SDOclient.h:160
CO_CANmodule_t * CANdevRx
From CO_SDOclient_init()
Definition CO_SDOclient.h:157
uint8_t block_blksize
Number of segments per block, 1..127.
Definition CO_SDOclient.h:199
uint32_t timeoutTimer
Timeout timer for SDO communication.
Definition CO_SDOclient.h:181
volatile CO_SDO_state_t state
Internal state of the SDO client.
Definition CO_SDOclient.h:179
uint16_t block_crc
Calculated CRC checksum.
Definition CO_SDOclient.h:203
void * functSignalObject
From CO_SDOclient_initCallbackPre() or NULL.
Definition CO_SDOclient.h:190
CO_CANtx_t * CANtxBuff
CAN transmit buffer inside CANdevTx for CAN tx message.
Definition CO_SDOclient.h:161
uint8_t toggle
Toggle bit toggled in each segment in segmented transfer.
Definition CO_SDOclient.h:193
uint8_t block_seqno
Sequence number of segment in block, 1..127.
Definition CO_SDOclient.h:198
CO_fifo_t bufFifo
CO_fifo_t object for data buffer (not pointer)
Definition CO_SDOclient.h:182
uint32_t COB_IDServerToClient
Copy of CANopen COB_ID Server -> Client, similar as above.
Definition CO_SDOclient.h:168
uint8_t subIndex
Subindex of current object in Object Dictionary.
Definition CO_SDOclient.h:174
volatile void * CANrxNew
Indicates, if new SDO message received from CAN bus.
Definition CO_SDOclient.h:185
bool_t block_crcEnabled
Server CRC support in block transfer.
Definition CO_SDOclient.h:201
uint32_t COB_IDClientToServer
Copy of CANopen COB_ID Client -> Server, meaning of the specific bits:
Definition CO_SDOclient.h:164
uint32_t block_timeoutTimer
Timeout timer for SDO sub-block upload.
Definition CO_SDOclient.h:197
bool_t finished
If true, then data transfer is finished.
Definition CO_SDOclient.h:175
uint8_t nodeIDOfTheSDOServer
Node-ID of the SDO server.
Definition CO_SDOclient.h:171
size_t sizeTran
Size of data which is actually transferred.
Definition CO_SDOclient.h:178
OD_extension_t OD_1280_extension
Extension for OD object.
Definition CO_SDOclient.h:169
OD_t * OD
From CO_SDOclient_init()
Definition CO_SDOclient.h:153
uint32_t SDOtimeoutTime_us
Maximum timeout time between request and response in microseconds.
Definition CO_SDOclient.h:180
CO_CANmodule_t * CANdevTx
From CO_SDOclient_init()
Definition CO_SDOclient.h:159
uint16_t index
Index of current object in Object Dictionary.
Definition CO_SDOclient.h:173
uint32_t block_SDOtimeoutTime_us
Timeout time for SDO sub-block upload, half of SDOtimeoutTime_us.
Definition CO_SDOclient.h:196
uint16_t CANdevRxIdx
From CO_SDOclient_init()
Definition CO_SDOclient.h:158
Fifo object.
Definition CO_fifo.h:55
Structure for input / output on the OD variable.
Definition CO_ODinterface.h:181
Object Dictionary entry for one OD object.
Definition CO_ODinterface.h:272
Extension of OD object, which can optionally be specified by application in initialization phase with...
Definition CO_ODinterface.h:245
Object Dictionary.
Definition CO_ODinterface.h:284