CANopenNode
CANopen protocol stack
Data Structures | Macros | Typedefs | Enumerations | Functions
CO_ODinterface.h File Reference

CANopen Object Dictionary interface. More...

#include "301/CO_driver.h"
+ Include dependency graph for CO_ODinterface.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

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_extension_t
 Extension of OD object, which can optionally be specified by application in initialization phase with OD_extension_init() function. 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...
 

Macros

#define OD_FLAGS_PDO_SIZE   4
 Size of of flagsPDO variable inside OD_extension_t, from 0 to 32.
 
#define CO_PROGMEM   const
 Modifier for OD objects. More...
 

Typedefs

typedef uint32_t OD_size_t
 Variable of type OD_size_t contains data length in bytes of OD variable.
 
typedef uint8_t OD_attr_t
 Type (and 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_PARAMETERS = 0x1010U , OD_H1011_RESTORE_DEFAULT = 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_TYPE_MASK = 0x0F }
 Types for OD object. More...
 

Functions

ODR_t OD_readOriginal (OD_stream_t *stream, void *buf, OD_size_t count, OD_size_t *countRead)
 Read value from original OD location. More...
 
ODR_t OD_writeOriginal (OD_stream_t *stream, const void *buf, OD_size_t count, OD_size_t *countWritten)
 Write value to original OD location. More...
 
OD_entry_tOD_find (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_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 bool_t OD_mappable (OD_stream_t *stream)
 Check, if OD variable is mappable to PDO or SRDO. More...
 
static void OD_rwRestart (OD_stream_t *stream)
 Restart read or write operation on OD variable. More...
 
static uint8_tOD_getFlagsPDO (OD_entry_t *entry)
 Get TPDO request flags for OD entry. More...
 
static void OD_requestTPDO (uint8_t *flagsPDO, uint8_t subIndex)
 Request TPDO, to which OD variable is mapped. More...
 
static bool_t OD_TPDOtransmitted (uint8_t *flagsPDO, uint8_t subIndex)
 Check if requested TPDO was transmitted. More...
 
uint32_t OD_getSDOabCode (ODR_t returnCode)
 Get SDO abort code from returnCode. More...
 
static ODR_t OD_extension_init (OD_entry_t *entry, OD_extension_t *extension)
 Extend OD object with own read/write functions and/or flagsPDO. More...
 
ODR_t OD_get_value (const OD_entry_t *entry, uint8_t subIndex, void *val, OD_size_t len, bool_t odOrig)
 Get variable from Object Dictionary. More...
 
static 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, see OD_get_value.
 
static 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_value.
 
static 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_value.
 
static 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_value.
 
static 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_value.
 
static 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_value.
 
static 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_value.
 
static 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_value.
 
static ODR_t OD_get_f32 (const OD_entry_t *entry, uint8_t subIndex, float32_t *val, bool_t odOrig)
 Get float32_t variable from Object Dictionary, see OD_get_value.
 
static ODR_t OD_get_f64 (const OD_entry_t *entry, uint8_t subIndex, float64_t *val, bool_t odOrig)
 Get float64_t variable from Object Dictionary, see OD_get_value.
 
ODR_t OD_set_value (const OD_entry_t *entry, uint8_t subIndex, void *val, OD_size_t len, bool_t odOrig)
 Set variable in Object Dictionary. More...
 
static 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, see OD_set_value.
 
static 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_value.
 
static ODR_t OD_set_i32 (const OD_entry_t *entry, uint8_t subIndex, int32_t val, bool_t odOrig)
 Set int32_t variable in Object Dictionary, see OD_set_value.
 
static ODR_t OD_set_i64 (const OD_entry_t *entry, uint8_t subIndex, int64_t val, bool_t odOrig)
 Set int32_t variable in Object Dictionary, see OD_set_value.
 
static 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_value.
 
static 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_value.
 
static 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_value.
 
static 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_value.
 
static ODR_t OD_set_f32 (const OD_entry_t *entry, uint8_t subIndex, float32_t val, bool_t odOrig)
 Set float32_t variable in Object Dictionary, see OD_set_value.
 
static ODR_t OD_set_f64 (const OD_entry_t *entry, uint8_t subIndex, float64_t val, bool_t odOrig)
 Set float64_t variable in Object Dictionary, see OD_set_value.
 
void * OD_getPtr (const OD_entry_t *entry, uint8_t subIndex, OD_size_t len, ODR_t *err)
 Get pointer to memory which holds data variable from Object Dictionary. More...
 

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.