CANopen Slave Documentation
Version 6.16.04
Loading...
Searching...
No Matches
cos_defs.h File Reference

Detailed Description

The file cos_defs.h holds global definitions, constants and structures for the CANopen Slave. The files canopen.h and cos_conf.h are included by this header.

+ Include dependency graph for cos_defs.h:

Macros

#define COS_VERSION_MAJOR   6
 
#define COS_VERSION_MINOR   16
 
#define COS_VERSION_BUILD   04
 

Enumerations

enum  CosBuf_e {
  eCosBuf_NMT = eCP_BUFFER_1 ,
  eCosBuf_SYNC ,
  eCosBuf_SDO_RCV ,
  eCosBuf_SDO_TRM ,
  eCosBuf_NMT_ERR ,
  eCosBuf_PDO1_RCV = eCosBuf_NMT_ERR + COS_DICT_OBJ_1016 + COS_DICT_OBJ_1012 + 1 + COS_SRDO_NUMBER + COS_SAFETY_SUPPORT ,
  eCosBuf_PDO1_TRM = eCosBuf_PDO1_RCV + COS_PDO_RCV_NUMBER ,
  eCosBuf_EMCY = eCosBuf_PDO1_TRM + COS_PDO_TRM_NUMBER
}
 
enum  COS_PARM_e {
  eCOS_PARM_NONE = 0 ,
  eCOS_PARM_ALL ,
  eCOS_PARM_COM ,
  eCOS_PARM_APP ,
  eCOS_PARM_MAN
}
 
enum  CosSdo_e {
  eCosSdo_READ_OK = 0 ,
  eCosSdo_READ1_OK = 1 ,
  eCosSdo_READ2_OK = 2 ,
  eCosSdo_READ3_OK = 3 ,
  eCosSdo_READ4_OK = 4 ,
  eCosSdo_READ_SEG_OK = 5 ,
  eCosSdo_WRITE_OK = 6 ,
  eCosSdo_ERR_TOGGLE_BIT = 20 ,
  eCosSdo_ERR_TIMEOUT = 21 ,
  eCosSdo_ERR_COMMAND = 22 ,
  eCosSdo_ERR_BLOCK_SIZE = 23 ,
  eCosSdo_ERR_BLOCK_SEQUENCE = 24 ,
  eCosSdo_ERR_BLOCK_CRC = 25 ,
  eCosSdo_ERR_MEMORY = 26 ,
  eCosSdo_ERR_ACCESS_UNSUPPORTED = 27 ,
  eCosSdo_ERR_ACCESS_WO = 28 ,
  eCosSdo_ERR_ACCESS_RO = 29 ,
  eCosSdo_ERR_NO_OBJECT = 30 ,
  eCosSdo_ERR_MAPPING_OBJECT = 31 ,
  eCosSdo_ERR_MAPPING_LENGTH = 32 ,
  eCosSdo_ERR_GENERAL_PARAMETER = 33 ,
  eCosSdo_ERR_GENERAL_DEVICE = 34 ,
  eCosSdo_ERR_HARDWARE = 35 ,
  eCosSdo_ERR_DATATYPE = 36 ,
  eCosSdo_ERR_DATATYPE_HIGH = 37 ,
  eCosSdo_ERR_DATATYPE_LOW = 38 ,
  eCosSdo_ERR_NO_SUB_INDEX = 39 ,
  eCosSdo_ERR_VALUE_RANGE = 40 ,
  eCosSdo_ERR_VALUE_HIGH = 41 ,
  eCosSdo_ERR_VALUE_LOW = 42 ,
  eCosSdo_ERR_VALUE_MIN_MAX = 43 ,
  eCosSdo_ERR_GENERAL = 44 ,
  eCosSdo_ERR_DATA_STORE = 45 ,
  eCosSdo_ERR_DATA_STORE_LOCAL = 46 ,
  eCosSdo_ERR_DATA_STORE_STATE = 47 ,
  eCosSdo_ERR_OBJECT_DICTIONARY = 48 ,
  eCosSdo_ERR_NO_DATA = 49 ,
  eCosSdo_ERR_DEFER_RESPONSE = 50 ,
  eCosSdo_ERR_MAX = 51
}
 
enum  CosErr_e {
  eCOS_ERR_NONE = 0 ,
  eCOS_ERR_CAN_INIT = 0x01 ,
  eCOS_ERR_CAN_FAIL = 0x02 ,
  eCOS_ERR_NODE_INIT = 0x10 ,
  eCOS_ERR_NODE_RESET = 0x11 ,
  eCOS_ERR_VALUE_NODE_ID = 0x30 ,
  eCOS_ERR_VALUE_BITRATE = 0x31 ,
  eCOS_ERR_VALUE_INDEX = 0x32 ,
  eCOS_ERR_VALUE_SUB_INDEX = 0x33 ,
  eCOS_ERR_VALUE_IDENTIFIER = 0x34 ,
  eCOS_ERR_VALUE_PARAMETER = 0x35 ,
  eCOS_ERR_PARM_LOAD = 0x40 ,
  eCOS_ERR_PARM_SAVE = 0x41 ,
  eCOS_ERR_LSS_VALUE = 0x50 ,
  eCOS_ERR_SERVICE_NOT_AVAILABLE = 0x58
}
 

Macro Definition Documentation

◆ COS_VERSION_BUILD

#define COS_VERSION_BUILD   04

Build version.

This is the build version of the protocol stack. It is updated on changes of the stacks examples or documentation.

◆ COS_VERSION_MAJOR

#define COS_VERSION_MAJOR   6

Major version number of CANopen slave stack. The version number of the CANopen Slave protocol stack is reflected by object 1018h:03h (see Cos301_Idx1018()).

◆ COS_VERSION_MINOR

#define COS_VERSION_MINOR   16

Minor version number of CANopen slave stack. The version number of the CANopen slave protocol stack is reflected by object 1018h:03h (see Cos301_Idx1018()).

Enumeration Type Documentation

◆ COS_PARM_e

enum COS_PARM_e

Parameter block for Store / Restore.

The following enumeration defines the parameter block that has been selected for a store / restore operation.

Enumerator
eCOS_PARM_NONE 

no parameter block selected

eCOS_PARM_ALL 

all parameters

eCOS_PARM_COM 

parameters from the communication profile

eCOS_PARM_APP 

application parameters (device profile)

eCOS_PARM_MAN 

manufacturer parameters

◆ CosBuf_e

enum CosBuf_e

Message buffer allocation.

Each CANopen service (i.e. identifier) is assigned to a specific message buffer in the CAN controller. For BasicCAN controllers the message buffers must be emulated in software (refer to CANpie).

Enumerator
eCosBuf_NMT 

NMT, Identifier 000h (Buffer 1)

eCosBuf_SYNC 

SYNC, Identifier 080h (Buffer 2)

eCosBuf_SDO_RCV 

SDO Rx, Identifier 600h + NodeId (Buffer 3)

eCosBuf_SDO_TRM 

SDO Tx, Identifier 580h + NodeId (Buffer 4)

eCosBuf_NMT_ERR 

Heartbeat producer, Nodeguarding (Buffer 7)

eCosBuf_PDO1_RCV 

Heartbeat consumer, (Buffer 8)

TIME producer / consumer, (Buffer 9)

Buffer for first Receive PDO

eCosBuf_PDO1_TRM 

Buffer for first Transmit PDO

eCosBuf_EMCY 

Buffer for emergency service

◆ CosCOB_ID_Store_e

COB-ID storage behaviour.

Enumerator
eCosCOB_ID_Store_KEEP 

keep stored data

eCosCOB_ID_Store_PREDEF 

use pre-defined connection set

eCosCOB_ID_Store_OFFSET 

use offset

◆ CosErr_e

enum CosErr_e

Error Codes of protocol stack.

All error codes of the CANopen slave protocol stack have the prefix 'eCOS_ERR_'.

Enumerator
eCOS_ERR_NONE 

No error

eCOS_ERR_CAN_INIT 

CAN interface not initialised

eCOS_ERR_CAN_FAIL 

Access to CAN interface failed

eCOS_ERR_NODE_INIT 

Node is not initialised

eCOS_ERR_NODE_RESET 

Reset request for Node

eCOS_ERR_VALUE_NODE_ID 

Node ID (device address) is out of range

eCOS_ERR_VALUE_BITRATE 

Bit-rate is out of range

eCOS_ERR_VALUE_INDEX 

Index not valid / out of range

eCOS_ERR_VALUE_SUB_INDEX 

Sub-index not valid / out of range

eCOS_ERR_VALUE_IDENTIFIER 

Identifier is out of range

eCOS_ERR_VALUE_PARAMETER 

General parameter out of range

eCOS_ERR_PARM_LOAD 

Failure of parameter load operation

eCOS_ERR_PARM_SAVE 

Failure of parameter save operation

eCOS_ERR_LSS_VALUE 

Value for LSS parameter out of range

eCOS_ERR_SERVICE_NOT_AVAILABLE 

Service (e.g. SDO client) not available

◆ CosSdo_e

enum CosSdo_e

Return code for SDO callbacks.

The following codes are used by callback functions for object dictionary access by Service Data Objects.

Enumerator
eCosSdo_READ_OK 

Generic read success (any number of bytes)

eCosSdo_READ1_OK 

Read success, 1 byte of data in expedited SDO

eCosSdo_READ2_OK 

Read success, 2 bytes of data in expedited SDO

eCosSdo_READ3_OK 

Read success, 3 bytes of data in expedited SDO

eCosSdo_READ4_OK 

Read success, 4 bytes of data in expedited SDO

eCosSdo_WRITE_OK 

Write success

eCosSdo_ERR_TOGGLE_BIT 

Toggle bit not alternated.

eCosSdo_ERR_TIMEOUT 

SDO protocol timed out.

eCosSdo_ERR_COMMAND 

Client/server command specifier not valid or unknown.

eCosSdo_ERR_BLOCK_SIZE 

Invalid block size (block mode only).

eCosSdo_ERR_BLOCK_SEQUENCE 

Invalid sequence number (block mode only).

eCosSdo_ERR_BLOCK_CRC 

CRC error (block mode only).

eCosSdo_ERR_MEMORY 

Out of memory.

eCosSdo_ERR_ACCESS_UNSUPPORTED 

Unsupported access to an object.

eCosSdo_ERR_ACCESS_WO 

Attempt to read a write only object.

eCosSdo_ERR_ACCESS_RO 

Attempt to write a read only object.

eCosSdo_ERR_NO_OBJECT 

Object does not exist in the object dictionary.

eCosSdo_ERR_MAPPING_OBJECT 

Object cannot be mapped to the PDO.

eCosSdo_ERR_MAPPING_LENGTH 

The number and length of the objects to be mapped would exceed PDO length.

eCosSdo_ERR_GENERAL_PARAMETER 

General parameter incompatibility reason.

eCosSdo_ERR_GENERAL_DEVICE 

General internal incompatibility in the device.

eCosSdo_ERR_HARDWARE 

Access failed due to an hardware error.

eCosSdo_ERR_DATATYPE 

Data type does not match or length of service parameter does not match.

eCosSdo_ERR_DATATYPE_HIGH 

Data type does not match or length of service parameter too high.

eCosSdo_ERR_DATATYPE_LOW 

Data type does not match or length of service parameter too low.

eCosSdo_ERR_NO_SUB_INDEX 

Sub-index does not exist.

eCosSdo_ERR_VALUE_RANGE 

Value range of parameter exceeded (only for write access).

eCosSdo_ERR_VALUE_HIGH 

Value of parameter written too high (download only).

eCosSdo_ERR_VALUE_LOW 

Value of parameter written too low (download only).

eCosSdo_ERR_VALUE_MIN_MAX 

Maximum value is less than minimum value.

eCosSdo_ERR_GENERAL 

General SDO error.

eCosSdo_ERR_DATA_STORE 

Data cannot be transferred or stored to the application.

eCosSdo_ERR_DATA_STORE_LOCAL 

Data cannot be transferred or stored to the application because of local control.

eCosSdo_ERR_DATA_STORE_STATE 

Data cannot be transferred or stored to the application because of the present device state.

eCosSdo_ERR_OBJECT_DICTIONARY 

Object dictionary dynamic generation fails or no object dictionary is present (e.g. object dictionary is generated from file and generation fails because of an file error).

eCosSdo_ERR_NO_DATA 

Data actually not available for access

eCosSdo_ERR_DEFER_RESPONSE 

Do not send a SDO response by the stack. The application must send the SDO response manually.