CANopenNode
CO_ODinterface.h File Reference

CANopen Object Dictionary interface. More...

#include "301/CO_driver.h"

Go to the source code of this file.

Data Structures

struct  OD_subEntry_t
 Structure describing properties of a variable, located in specific index and sub-index inside the Object Dictionary. More...
 
struct  OD_stream_t
 IO stream structure, used for read/write access to OD variable, part of OD_IO_t. More...
 
struct  OD_IO_t
 Structure for input / output on the OD variable. More...
 
struct  OD_entry_t
 Object Dictionary entry for one OD object. More...
 
struct  OD_t
 Object Dictionary. More...
 
struct  OD_obj_var_t
 Object for single OD variable, used for "VAR" type OD objects. More...
 
struct  OD_obj_array_t
 Object for OD array of variables, used for "ARRAY" type OD objects. More...
 
struct  OD_obj_record_t
 Object for OD sub-elements, used in "RECORD" type OD objects. More...
 
struct  OD_extensionIO_t
 Object pointed by OD_obj_extended_t contains application specified parameters for extended OD object. More...
 
struct  OD_obj_extended_t
 Object for extended type of OD variable, configurable by OD_extensionIO_init() function. More...
 

Macros

#define OD_size_t   uint32_t
 Variable of type OD_size_t contains data length in bytes of OD variable.
 
#define OD_flagsPDO_t   uint32_t
 Type of flagsPDO variable from OD_subEntry_t.
 
#define OD_attr_t   uint8_t
 Size of Object Dictionary attribute.
 

Enumerations

enum  OD_ObjDicId_30x_t {
  OD_H1000_DEV_TYPE = 0x1000U, OD_H1001_ERR_REG = 0x1001U, OD_H1002_MANUF_STATUS_REG = 0x1002U, OD_H1003_PREDEF_ERR_FIELD = 0x1003U,
  OD_H1004_RSV = 0x1004U, OD_H1005_COBID_SYNC = 0x1005U, OD_H1006_COMM_CYCL_PERIOD = 0x1006U, OD_H1007_SYNC_WINDOW_LEN = 0x1007U,
  OD_H1008_MANUF_DEV_NAME = 0x1008U, OD_H1009_MANUF_HW_VERSION = 0x1009U, OD_H100A_MANUF_SW_VERSION = 0x100AU, OD_H100B_RSV = 0x100BU,
  OD_H100C_GUARD_TIME = 0x100CU, OD_H100D_LIFETIME_FACTOR = 0x100DU, OD_H100E_RSV = 0x100EU, OD_H100F_RSV = 0x100FU,
  OD_H1010_STORE_PARAM_FUNC = 0x1010U, OD_H1011_REST_PARAM_FUNC = 0x1011U, OD_H1012_COBID_TIME = 0x1012U, OD_H1013_HIGH_RES_TIMESTAMP = 0x1013U,
  OD_H1014_COBID_EMERGENCY = 0x1014U, OD_H1015_INHIBIT_TIME_EMCY = 0x1015U, OD_H1016_CONSUMER_HB_TIME = 0x1016U, OD_H1017_PRODUCER_HB_TIME = 0x1017U,
  OD_H1018_IDENTITY_OBJECT = 0x1018U, OD_H1019_SYNC_CNT_OVERFLOW = 0x1019U, OD_H1020_VERIFY_CONFIG = 0x1020U, OD_H1021_STORE_EDS = 0x1021U,
  OD_H1022_STORE_FORMAT = 0x1022U, OD_H1023_OS_CMD = 0x1023U, OD_H1024_OS_CMD_MODE = 0x1024U, OD_H1025_OS_DBG_INTERFACE = 0x1025U,
  OD_H1026_OS_PROMPT = 0x1026U, OD_H1027_MODULE_LIST = 0x1027U, OD_H1028_EMCY_CONSUMER = 0x1028U, OD_H1029_ERR_BEHAVIOR = 0x1029U,
  OD_H1200_SDO_SERVER_1_PARAM = 0x1200U, OD_H1280_SDO_CLIENT_1_PARAM = 0x1280U, OD_H1300_GFC_PARAM = 0x1300U, OD_H1301_SRDO_1_PARAM = 0x1301U,
  OD_H1381_SRDO_1_MAPPING = 0x1381U, OD_H13FE_SRDO_VALID = 0x13FEU, OD_H13FF_SRDO_CHECKSUM = 0x13FFU, OD_H1400_RXPDO_1_PARAM = 0x1400U,
  OD_H1600_RXPDO_1_MAPPING = 0x1600U, OD_H1800_TXPDO_1_PARAM = 0x1800U, OD_H1A00_TXPDO_1_MAPPING = 0x1A00U
}
 Common DS301 object dictionary entries. More...
 
enum  OD_attributes_t {
  ODA_SDO_R = 0x01, ODA_SDO_W = 0x02, ODA_SDO_RW = 0x03, ODA_TPDO = 0x04,
  ODA_RPDO = 0x08, ODA_TRPDO = 0x0C, ODA_TSRDO = 0x10, ODA_RSRDO = 0x20,
  ODA_TRSRDO = 0x30, ODA_MB = 0x40, ODA_STR = 0x80
}
 Attributes (bit masks) for OD sub-object. More...
 
enum  ODR_t {
  ODR_PARTIAL = -1, ODR_OK = 0, ODR_OUT_OF_MEM = 1, ODR_UNSUPP_ACCESS = 2,
  ODR_WRITEONLY = 3, ODR_READONLY = 4, ODR_IDX_NOT_EXIST = 5, ODR_NO_MAP = 6,
  ODR_MAP_LEN = 7, ODR_PAR_INCOMPAT = 8, ODR_DEV_INCOMPAT = 9, ODR_HW = 10,
  ODR_TYPE_MISMATCH = 11, ODR_DATA_LONG = 12, ODR_DATA_SHORT = 13, ODR_SUB_NOT_EXIST = 14,
  ODR_INVALID_VALUE = 15, ODR_VALUE_HIGH = 16, ODR_VALUE_LOW = 17, ODR_MAX_LESS_MIN = 18,
  ODR_NO_RESOURCE = 19, ODR_GENERAL = 20, ODR_DATA_TRANSF = 21, ODR_DATA_LOC_CTRL = 22,
  ODR_DATA_DEV_STATE = 23, ODR_OD_MISSING = 23, ODR_NO_DATA = 25, ODR_COUNT = 26
}
 Return codes from OD access functions. More...
 
enum  OD_objectTypes_t {
  ODT_VAR = 0x01, ODT_ARR = 0x02, ODT_REC = 0x03, ODT_EVAR = 0x11,
  ODT_EARR = 0x12, ODT_EREC = 0x13, ODT_TYPE_MASK = 0x0F, ODT_EXTENSION_MASK = 0x10
}
 Types for OD object. More...
 

Functions

OD_size_t OD_readOriginal (OD_stream_t *stream, uint8_t subIndex, void *buf, OD_size_t count, ODR_t *returnCode)
 Read value from original OD location. More...
 
OD_size_t OD_writeOriginal (OD_stream_t *stream, uint8_t subIndex, const void *buf, OD_size_t count, ODR_t *returnCode)
 Write value to original OD location. More...
 
const OD_entry_tOD_find (const OD_t *od, uint16_t index)
 Find OD entry in Object Dictionary. More...
 
ODR_t OD_getSub (const OD_entry_t *entry, uint8_t subIndex, OD_subEntry_t *subEntry, OD_IO_t *io, bool_t odOrig)
 Find sub-object with specified sub-index on OD entry returned by OD_find. More...
 
static uint16_t OD_getIndex (const OD_entry_t *entry)
 Return index from OD entry. More...
 
static void OD_rwRestart (OD_stream_t *stream)
 Restart read or write operation on OD variable. More...
 
uint32_t OD_getSDOabCode (ODR_t returnCode)
 Get SDO abort code from returnCode. More...
 
ODR_t OD_extensionIO_init (const OD_entry_t *entry, void *object, OD_size_t(*read)(OD_stream_t *stream, uint8_t subIndex, void *buf, OD_size_t count, ODR_t *returnCode), OD_size_t(*write)(OD_stream_t *stream, uint8_t subIndex, const void *buf, OD_size_t count, ODR_t *returnCode))
 Initialise extended OD object with own read/write functions. More...
 
ODR_t OD_get_i8 (const OD_entry_t *entry, uint8_t subIndex, int8_t *val, bool_t odOrig)
 Get int8_t variable from Object Dictionary. More...
 
ODR_t OD_get_i16 (const OD_entry_t *entry, uint8_t subIndex, int16_t *val, bool_t odOrig)
 Get int16_t variable from Object Dictionary, see OD_get_i8.
 
ODR_t OD_get_i32 (const OD_entry_t *entry, uint8_t subIndex, int32_t *val, bool_t odOrig)
 Get int32_t variable from Object Dictionary, see OD_get_i8.
 
ODR_t OD_get_i64 (const OD_entry_t *entry, uint8_t subIndex, int64_t *val, bool_t odOrig)
 Get int64_t variable from Object Dictionary, see OD_get_i8.
 
ODR_t OD_get_u8 (const OD_entry_t *entry, uint8_t subIndex, uint8_t *val, bool_t odOrig)
 Get uint8_t variable from Object Dictionary, see OD_get_i8.
 
ODR_t OD_get_u16 (const OD_entry_t *entry, uint8_t subIndex, uint16_t *val, bool_t odOrig)
 Get uint16_t variable from Object Dictionary, see OD_get_i8.
 
ODR_t OD_get_u32 (const OD_entry_t *entry, uint8_t subIndex, uint32_t *val, bool_t odOrig)
 Get uint32_t variable from Object Dictionary, see OD_get_i8.
 
ODR_t OD_get_u64 (const OD_entry_t *entry, uint8_t subIndex, uint64_t *val, bool_t odOrig)
 Get uint64_t variable from Object Dictionary, see OD_get_i8.
 
ODR_t OD_get_r32 (const OD_entry_t *entry, uint8_t subIndex, float32_t *val, bool_t odOrig)
 Get float32_t variable from Object Dictionary, see OD_get_i8.
 
ODR_t OD_get_r64 (const OD_entry_t *entry, uint8_t subIndex, float64_t *val, bool_t odOrig)
 Get float64_t variable from Object Dictionary, see OD_get_i8.
 
ODR_t OD_set_i8 (const OD_entry_t *entry, uint8_t subIndex, int8_t val, bool_t odOrig)
 Set int8_t variable in Object Dictionary. More...
 
ODR_t OD_set_i16 (const OD_entry_t *entry, uint8_t subIndex, int16_t val, bool_t odOrig)
 Set int16_t variable in Object Dictionary, see OD_set_i8.
 
ODR_t OD_set_i32 (const OD_entry_t *entry, uint8_t subIndex, int32_t val, bool_t odOrig)
 Set int16_t variable in Object Dictionary, see OD_set_i8.
 
ODR_t OD_set_i64 (const OD_entry_t *entry, uint8_t subIndex, int64_t val, bool_t odOrig)
 Set int16_t variable in Object Dictionary, see OD_set_i8.
 
ODR_t OD_set_u8 (const OD_entry_t *entry, uint8_t subIndex, uint8_t val, bool_t odOrig)
 Set uint8_t variable in Object Dictionary, see OD_set_i8.
 
ODR_t OD_set_u16 (const OD_entry_t *entry, uint8_t subIndex, uint16_t val, bool_t odOrig)
 Set uint16_t variable in Object Dictionary, see OD_set_i8.
 
ODR_t OD_set_u32 (const OD_entry_t *entry, uint8_t subIndex, uint32_t val, bool_t odOrig)
 Set uint32_t variable in Object Dictionary, see OD_set_i8.
 
ODR_t OD_set_u64 (const OD_entry_t *entry, uint8_t subIndex, uint64_t val, bool_t odOrig)
 Set uint64_t variable in Object Dictionary, see OD_set_i8.
 
ODR_t OD_set_r32 (const OD_entry_t *entry, uint8_t subIndex, float32_t val, bool_t odOrig)
 Set float32_t variable in Object Dictionary, see OD_set_i8.
 
ODR_t OD_set_r64 (const OD_entry_t *entry, uint8_t subIndex, float64_t val, bool_t odOrig)
 Set float64_t variable in Object Dictionary, see OD_set_i8.
 
ODR_t OD_getPtr_i8 (const OD_entry_t *entry, uint8_t subIndex, int8_t **val)
 Get pointer to int8_t variable from Object Dictionary. More...
 
ODR_t OD_getPtr_i16 (const OD_entry_t *entry, uint8_t subIndex, int16_t **val)
 Get pointer to int16_t variable from OD, see OD_getPtr_i8.
 
ODR_t OD_getPtr_i32 (const OD_entry_t *entry, uint8_t subIndex, int32_t **val)
 Get pointer to int32_t variable from OD, see OD_getPtr_i8.
 
ODR_t OD_getPtr_i64 (const OD_entry_t *entry, uint8_t subIndex, int64_t **val)
 Get pointer to int64_t variable from OD, see OD_getPtr_i8.
 
ODR_t OD_getPtr_u8 (const OD_entry_t *entry, uint8_t subIndex, uint8_t **val)
 Get pointer to uint8_t variable from OD, see OD_getPtr_i8.
 
ODR_t OD_getPtr_u16 (const OD_entry_t *entry, uint8_t subIndex, uint16_t **val)
 Get pointer to uint16_t variable from OD, see OD_getPtr_i8.
 
ODR_t OD_getPtr_u32 (const OD_entry_t *entry, uint8_t subIndex, uint32_t **val)
 Get pointer to uint32_t variable from OD, see OD_getPtr_i8.
 
ODR_t OD_getPtr_u64 (const OD_entry_t *entry, uint8_t subIndex, uint64_t **val)
 Get pointer to uint64_t variable from OD, see OD_getPtr_i8.
 
ODR_t OD_getPtr_r32 (const OD_entry_t *entry, uint8_t subIndex, float32_t **val)
 Get pointer to float32_t variable from OD, see OD_getPtr_i8.
 
ODR_t OD_getPtr_r64 (const OD_entry_t *entry, uint8_t subIndex, float64_t **val)
 Get pointer to float64_t variable from OD, see OD_getPtr_i8.
 
ODR_t OD_getPtr_vs (const OD_entry_t *entry, uint8_t subIndex, char **val, OD_size_t *dataLength)
 Get pointer to "visible string" variable from Object Dictionary. More...
 
ODR_t OD_getPtr_os (const OD_entry_t *entry, uint8_t subIndex, uint8_t **val, OD_size_t *dataLength)
 Get pointer to "octet string" variable from OD, see OD_getPtr_vs.
 
ODR_t OD_getPtr_us (const OD_entry_t *entry, uint8_t subIndex, uint16_t **val, OD_size_t *dataLength)
 Get pointer to "unicode string" variable from OD, see OD_getPtr_vs.
 

Detailed Description

CANopen Object Dictionary interface.

Author
Janez Paternoster

This file is part of CANopenNode, an opensource CANopen Stack. Project home page is https://github.com/CANopenNode/CANopenNode. For more information on CANopen see http://www.can-cia.org/.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.