Go to the documentation of this file.
26 #ifndef CO_SDO_SERVER_H
27 #define CO_SDO_SERVER_H
33 #ifndef CO_CONFIG_SDO_SRV
34 #define CO_CONFIG_SDO_SRV (CO_CONFIG_SDO_SRV_SEGMENTED)
36 #ifndef CO_CONFIG_SDO_SRV_BUFFER_SIZE
37 #define CO_CONFIG_SDO_SRV_BUFFER_SIZE 32
88 #define CO_SDO_ST_FLAG_DOWNLOAD 0x10U
89 #define CO_SDO_ST_FLAG_UPLOAD 0x20U
90 #define CO_SDO_ST_FLAG_BLOCK 0x40U
465 #if ((CO_CONFIG_SDO_SRV) & CO_CONFIG_FLAG_OD_DYNAMIC) || defined CO_DOXYGEN
480 #if ((CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_SEGMENTED) || defined CO_DOXYGEN
502 #if ((CO_CONFIG_SDO_SRV) & CO_CONFIG_SDO_SRV_BLOCK) || defined CO_DOXYGEN
518 #if ((CO_CONFIG_SDO_SRV) & CO_CONFIG_FLAG_CALLBACK_PRE) || defined CO_DOXYGEN
520 void (*pFunctSignalPre)(
void *object);
559 #if ((CO_CONFIG_SDO_SRV) & CO_CONFIG_FLAG_CALLBACK_PRE) || defined CO_DOXYGEN
575 void (*pFunctSignalPre)(
void *
object));
594 bool_t NMTisPreOrOperational,
unsigned long int uint32_t
UNSIGNED32 in CANopen (0007h), 32-bit unsigned integer.
Definition: CO_driver.h:155
uint32_t COB_IDClientToServer
Copy of CANopen COB_ID Client -> Server, meaning of the specific bits:
Definition: CO_SDOserver.h:476
uint8_t block_noData
Number of bytes in last segment that do not contain data.
Definition: CO_SDOserver.h:512
@ CO_SDO_AB_CRC
0x05040004, CRC error (block mode only)
Definition: CO_SDOserver.h:347
Interface between CAN hardware and CANopenNode.
@ CO_SDO_AB_CMD
0x05040001, Command specifier not valid or unknown
Definition: CO_SDOserver.h:341
@ CO_SDO_ST_DOWNLOAD_BLK_END_RSP
Definition: CO_SDOserver.h:252
void CO_SDOserver_initCallbackPre(CO_SDOserver_t *SDO, void *object, void(*pFunctSignalPre)(void *object))
Initialize SDOrx callback function.
void * functSignalObjectPre
From CO_SDOserver_initCallbackPre() or NULL.
Definition: CO_SDOserver.h:522
uint32_t timeoutTimer
Timeout timer for SDO communication.
Definition: CO_SDOserver.h:494
@ CO_SDO_AB_NONE
0x00000000, No abort
Definition: CO_SDOserver.h:335
@ CO_SDO_RT_ok_communicationEnd
Success, end of communication.
Definition: CO_SDOserver.h:426
#define CO_CONFIG_SDO_SRV_BUFFER_SIZE
Size of the internal data buffer for the SDO server.
Definition: CO_config.h:342
@ CO_SDO_AB_MAX_LESS_MIN
0x06090036, Maximum value is less than minimum value.
Definition: CO_SDOserver.h:387
SDO server object.
Definition: CO_SDOserver.h:439
@ CO_SDO_ST_DOWNLOAD_BLK_SUBBLOCK_RSP
Definition: CO_SDOserver.h:236
@ CO_SDO_AB_SEQ_NUM
0x05040003, Invalid sequence number in block mode
Definition: CO_SDOserver.h:345
@ CO_SDO_RT_waitingResponse
Waiting server or client response.
Definition: CO_SDOserver.h:424
CO_SDO_return_t
Return values from SDO server or client functions.
Definition: CO_SDOserver.h:410
@ CO_SDO_AB_DATA_LOC_CTRL
0x08000021, Data cannot be transferred or stored to application because of local control
Definition: CO_SDOserver.h:396
@ CO_SDO_AB_NO_DATA
0x08000024, No data available
Definition: CO_SDOserver.h:403
uint8_t block_seqno
Sequence number of segment in block, 1..127.
Definition: CO_SDOserver.h:508
unsigned int uint16_t
UNSIGNED16 in CANopen (0006h), 16-bit unsigned integer.
Definition: CO_driver.h:153
uint16_t index
Index of the current object in Object Dictionary.
Definition: CO_SDOserver.h:455
CO_ReturnError_t
Return values of some CANopen functions.
Definition: CO_driver.h:488
@ CO_SDO_AB_GENERAL
0x08000000, General error
Definition: CO_SDOserver.h:391
@ CO_SDO_AB_VALUE_HIGH
0x06090031, Value range of parameter written too high
Definition: CO_SDOserver.h:383
uint8_t block_blksize
Number of segments per block, 1..127.
Definition: CO_SDOserver.h:510
@ CO_SDO_ST_DOWNLOAD_BLK_INITIATE_RSP
Definition: CO_SDOserver.h:213
@ CO_SDO_AB_TIMEOUT
0x05040000, SDO protocol timed out
Definition: CO_SDOserver.h:339
@ CO_SDO_ST_UPLOAD_BLK_SUBBLOCK_SREQ
Definition: CO_SDOserver.h:289
unsigned char bool_t
Boolean data type for general use.
Definition: CO_driver.h:141
@ CO_SDO_ST_DOWNLOAD_BLK_SUBBLOCK_REQ
Definition: CO_SDOserver.h:221
@ CO_SDO_RT_wrongArguments
Error in arguments.
Definition: CO_SDOserver.h:428
@ CO_SDO_AB_UNSUPPORTED_ACCESS
0x06010000, Unsupported access to an object
Definition: CO_SDOserver.h:351
bool_t finished
If true, then: data transfer is finished (by download) or read from OD variable is finished (by uploa...
Definition: CO_SDOserver.h:490
@ CO_SDO_ST_UPLOAD_BLK_INITIATE_RSP
Definition: CO_SDOserver.h:275
@ CO_SDO_AB_READONLY
0x06010002, Attempt to write a read only object
Definition: CO_SDOserver.h:355
@ CO_SDO_ST_DOWNLOAD_SEGMENT_REQ
Definition: CO_SDOserver.h:147
@ CO_SDO_AB_DATA_DEV_STATE
0x08000022, Data cannot be transferred or stored to application because of present device state
Definition: CO_SDOserver.h:399
volatile void * CANrxNew
Indicates, if new SDO message received from CAN bus.
Definition: CO_SDOserver.h:462
OD_IO_t OD_IO
Object dictionary interface for current object.
Definition: CO_SDOserver.h:453
@ CO_SDO_ST_DOWNLOAD_INITIATE_REQ
Definition: CO_SDOserver.h:131
uint8_t toggle
Toggle bit toggled in each segment in segmented transfer.
Definition: CO_SDOserver.h:487
@ CO_SDO_ST_DOWNLOAD_BLK_END_REQ
Definition: CO_SDOserver.h:244
@ CO_SDO_AB_TYPE_MISMATCH
0x06070010, Data type does not match, length of service parameter does not match
Definition: CO_SDOserver.h:371
OD_size_t sizeTran
Size of data which is actually transferred.
Definition: CO_SDOserver.h:485
const OD_t * OD
From CO_SDOserver_init()
Definition: CO_SDOserver.h:445
@ CO_SDO_AB_DEVICE_INCOMPAT
0x06040047, General internal incompatibility in device
Definition: CO_SDOserver.h:366
@ CO_SDO_ST_DOWNLOAD_SEGMENT_RSP
Definition: CO_SDOserver.h:154
@ CO_SDO_AB_NO_RESOURCE
0x060A0023, Resource not available: SDO connection
Definition: CO_SDOserver.h:389
@ CO_SDO_AB_NOT_EXIST
0x06020000, Object does not exist in the object dictionary
Definition: CO_SDOserver.h:357
@ CO_SDO_AB_PRAM_INCOMPAT
0x06040043, General parameter incompatibility reasons
Definition: CO_SDOserver.h:364
@ CO_SDO_AB_INVALID_VALUE
0x06090030, Invalid value for parameter (download only).
Definition: CO_SDOserver.h:381
@ CO_SDO_AB_DATA_SHORT
0x06070013, Data type does not match, length of service parameter too short
Definition: CO_SDOserver.h:377
@ CO_SDO_RT_blockDownldInProgress
Block download is in progress.
Definition: CO_SDOserver.h:419
@ CO_SDO_AB_VALUE_LOW
0x06090032, Value range of parameter written too low
Definition: CO_SDOserver.h:385
@ CO_SDO_RT_uploadDataBufferFull
Data buffer is full.
Definition: CO_SDOserver.h:415
OD_size_t bufOffsetRd
Offset of first data available for read in the buffer.
Definition: CO_SDOserver.h:500
volatile CO_SDO_state_t state
Internal state of the SDO server.
Definition: CO_SDOserver.h:451
OD_attr_t attribute
Attribute bit-field of the current OD sub-object, see OD_attributes_t.
Definition: CO_SDOserver.h:459
@ CO_SDO_AB_BLOCK_SIZE
0x05040002, Invalid block size in block mode
Definition: CO_SDOserver.h:343
CO_ReturnError_t CO_SDOserver_init(CO_SDOserver_t *SDO, const OD_t *OD, const OD_entry_t *OD_1200_SDOsrvPar, uint8_t nodeId, uint16_t SDOtimeoutTime_ms, CO_CANmodule_t *CANdevRx, uint16_t CANdevRxIdx, CO_CANmodule_t *CANdevTx, uint16_t CANdevTxIdx)
Initialize SDO object.
Definition: CO_SDOserver.c:357
@ CO_SDO_RT_blockUploadInProgress
Block upload is in progress.
Definition: CO_SDOserver.h:422
uint16_t CANdevTxIdx
From CO_SDOserver_init()
Definition: CO_SDOserver.h:471
@ CO_SDO_AB_DATA_LONG
0x06070012, Data type does not match, length of service parameter too high
Definition: CO_SDOserver.h:374
@ CO_SDO_AB_WRITEONLY
0x06010001, Attempt to read a write only object
Definition: CO_SDOserver.h:353
@ CO_SDO_ST_UPLOAD_BLK_END_CRSP
Definition: CO_SDOserver.h:322
@ CO_SDO_ST_UPLOAD_BLK_INITIATE_REQ2
Definition: CO_SDOserver.h:281
@ CO_SDO_ST_UPLOAD_BLK_INITIATE_REQ
Definition: CO_SDOserver.h:265
CO_CANmodule_t * CANdevTx
From CO_SDOserver_init()
Definition: CO_SDOserver.h:441
@ CO_SDO_ST_UPLOAD_INITIATE_RSP
Definition: CO_SDOserver.h:179
CO_SDO_abortCode_t
SDO abort codes.
Definition: CO_SDOserver.h:333
@ CO_SDO_AB_NO_MAP
0x06040041, Object cannot be mapped to the PDO
Definition: CO_SDOserver.h:359
@ CO_SDO_RT_endedWithClientAbort
Communication ended with client abort.
Definition: CO_SDOserver.h:430
CO_CANmodule_t * CANdevRx
From CO_SDOserver_init()
Definition: CO_SDOserver.h:467
@ CO_SDO_ST_IDLE
Definition: CO_SDOserver.h:108
@ CO_SDO_RT_endedWithServerAbort
Communication ended with server abort.
Definition: CO_SDOserver.h:432
CO_SDO_state_t
Internal states of the SDO state machine.
Definition: CO_SDOserver.h:102
uint32_t SDOtimeoutTime_us
Maximum timeout time between request and response in microseconds.
Definition: CO_SDOserver.h:492
@ CO_SDO_AB_HW
0x06060000, Access failed due to hardware error
Definition: CO_SDOserver.h:368
@ CO_SDO_ST_UPLOAD_SEGMENT_REQ
Definition: CO_SDOserver.h:185
@ CO_SDO_ST_DOWNLOAD_LOCAL_TRANSFER
Definition: CO_SDOserver.h:121
uint16_t CANdevRxIdx
From CO_SDOserver_init()
Definition: CO_SDOserver.h:469
@ CO_SDO_ST_UPLOAD_INITIATE_REQ
Definition: CO_SDOserver.h:168
CANopen Object Dictionary interface.
uint16_t block_crc
Calculated CRC checksum.
Definition: CO_SDOserver.h:516
@ CO_SDO_ST_UPLOAD_SEGMENT_RSP
Definition: CO_SDOserver.h:194
@ CO_SDO_AB_OUT_OF_MEM
0x05040005, Out of memory
Definition: CO_SDOserver.h:349
uint8_t nodeId
From CO_SDOserver_init()
Definition: CO_SDOserver.h:447
@ CO_SDO_AB_DATA_OD
0x08000023, Object dictionary not present or dynamic generation fails
Definition: CO_SDOserver.h:401
Object Dictionary.
Definition: CO_ODinterface.h:352
@ CO_SDO_ST_UPLOAD_BLK_END_SREQ
Definition: CO_SDOserver.h:312
Complete CAN module object.
Definition: CO_driver.h:319
@ CO_SDO_AB_DATA_TRANSF
0x08000020, Data cannot be transferred or stored to application
Definition: CO_SDOserver.h:393
uint32_t COB_IDServerToClient
Copy of CANopen COB_ID Server -> Client, similar as above.
Definition: CO_SDOserver.h:478
uint32_t block_SDOtimeoutTime_us
Timeout time for SDO sub-block download, half of SDOtimeoutTime_us.
Definition: CO_SDOserver.h:504
Structure for input / output on the OD variable.
Definition: CO_ODinterface.h:263
@ CO_SDO_ST_UPLOAD_LOCAL_TRANSFER
Definition: CO_SDOserver.h:161
uint8_t subIndex
Subindex of the current object in Object Dictionary.
Definition: CO_SDOserver.h:457
OD_size_t sizeInd
Size of data, which will be transferred.
Definition: CO_SDOserver.h:483
Object Dictionary entry for one OD object.
Definition: CO_ODinterface.h:336
@ CO_SDO_ST_UPLOAD_BLK_SUBBLOCK_CRSP
Definition: CO_SDOserver.h:304
@ CO_SDO_ST_DOWNLOAD_INITIATE_RSP
Definition: CO_SDOserver.h:139
bool_t block_crcEnabled
Client CRC support in block transfer.
Definition: CO_SDOserver.h:514
@ CO_SDO_AB_SUB_UNKNOWN
0x06090011, Sub index does not exist
Definition: CO_SDOserver.h:379
@ CO_SDO_RT_waitingLocalTransfer
Waiting in client local transfer.
Definition: CO_SDOserver.h:412
CO_SDO_return_t CO_SDOserver_process(CO_SDOserver_t *SDO, bool_t NMTisPreOrOperational, uint32_t timeDifference_us, uint32_t *timerNext_us)
Process SDO communication.
Definition: CO_SDOserver.c:723
@ CO_SDO_AB_TOGGLE_BIT
0x05030000, Toggle bit not altered
Definition: CO_SDOserver.h:337
uint32_t block_timeoutTimer
Timeout timer for SDO sub-block download.
Definition: CO_SDOserver.h:506
CO_CANtx_t * CANtxBuff
CAN transmit buffer inside CANdevTx for CAN tx message.
Definition: CO_SDOserver.h:443
OD_size_t bufOffsetWr
Offset of next free data byte available for write in the buffer.
Definition: CO_SDOserver.h:498
@ CO_SDO_ST_ABORT
Definition: CO_SDOserver.h:114
Configuration object for CAN transmit message for specific CANopenNode Object.
Definition: CO_driver.h:299
@ CO_SDO_ST_DOWNLOAD_BLK_INITIATE_REQ
Definition: CO_SDOserver.h:203
unsigned char uint8_t
UNSIGNED8 in CANopen (0005h), 8-bit unsigned integer.
Definition: CO_driver.h:151
#define OD_size_t
Variable of type OD_size_t contains data length in bytes of OD variable.
Definition: CO_ODinterface.h:44
@ CO_SDO_RT_transmittBufferFull
CAN transmit buffer is full.
Definition: CO_SDOserver.h:417
#define OD_attr_t
Size of Object Dictionary attribute.
Definition: CO_ODinterface.h:50
@ CO_SDO_AB_MAP_LEN
0x06040042, Number and length of object to be mapped exceeds PDO length
Definition: CO_SDOserver.h:362