etisserant@0: /* etisserant@0: This file is part of CanFestival, a library implementing CanOpen Stack. etisserant@0: etisserant@0: Copyright (C): Edouard TISSERANT and Francis DUPIN etisserant@0: etisserant@0: See COPYING file for copyrights details. etisserant@0: etisserant@0: This library is free software; you can redistribute it and/or etisserant@0: modify it under the terms of the GNU Lesser General Public etisserant@0: License as published by the Free Software Foundation; either etisserant@0: version 2.1 of the License, or (at your option) any later version. etisserant@0: etisserant@0: This library is distributed in the hope that it will be useful, etisserant@0: but WITHOUT ANY WARRANTY; without even the implied warranty of etisserant@0: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU etisserant@0: Lesser General Public License for more details. etisserant@0: etisserant@0: You should have received a copy of the GNU Lesser General Public etisserant@0: License along with this library; if not, write to the Free Software etisserant@0: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA etisserant@0: */ etisserant@0: etisserant@0: #ifndef __objdictdef_h__ etisserant@0: #define __objdictdef_h__ etisserant@0: etisserant@0: /************************* CONSTANTES **********************************/ etisserant@0: /** this are static defined datatypes taken fCODE the canopen standard. They etisserant@0: * are located at index 0x0001 to 0x001B. As described in the standard, they etisserant@0: * are in the object dictionary for definition purpose only. a device does not etisserant@0: * to support all of this datatypes. etisserant@0: */ etisserant@0: #define boolean 0x01 etisserant@0: #define int8 0x02 etisserant@0: #define int16 0x03 etisserant@0: #define int32 0x04 etisserant@0: #define uint8 0x05 etisserant@0: #define uint16 0x06 etisserant@0: #define uint32 0x07 etisserant@0: #define real32 0x08 etisserant@0: #define visible_string 0x09 etisserant@0: #define octet_string 0x0A etisserant@0: #define unicode_string 0x0B etisserant@0: #define time_of_day 0x0C etisserant@0: #define time_difference 0x0D etisserant@0: etisserant@0: #define domain 0x0F etisserant@0: #define int24 0x10 etisserant@0: #define real64 0x11 etisserant@0: #define int40 0x12 etisserant@0: #define int48 0x13 etisserant@0: #define int56 0x14 etisserant@0: #define int64 0x15 etisserant@0: #define uint24 0x16 etisserant@0: etisserant@0: #define uint40 0x18 etisserant@0: #define uint48 0x19 etisserant@0: #define uint56 0x1A etisserant@0: #define uint64 0x1B etisserant@0: etisserant@0: #define pdo_communication_parameter 0x20 etisserant@0: #define pdo_mapping 0x21 etisserant@0: #define sdo_parameter 0x22 etisserant@0: #define identity 0x23 etisserant@0: frdupin@71: /* CanFestival is using 0x24 to 0xFF to define some types containing a frdupin@71: value range (See how it works in objdict.c) frdupin@71: */ etisserant@0: etisserant@0: etisserant@0: /** Each entry of the object dictionary can be READONLY (RO), READ/WRITE (RW), etisserant@0: * WRITE-ONLY (WO) etisserant@0: */ etisserant@0: #define RW 0x00 etisserant@0: #define WO 0x01 etisserant@0: #define RO 0x02 etisserant@0: etisserant@161: #define TO_BE_SAVE 0x04 groke6@349: #define DCF_TO_SEND 0x08 etisserant@0: etisserant@0: /************************ STRUCTURES ****************************/ etisserant@0: /** This are some structs which are neccessary for creating the entries etisserant@0: * of the object dictionary. etisserant@0: */ etisserant@0: typedef struct td_subindex etisserant@0: { etisserant@0: UNS8 bAccessType; frdupin@71: UNS8 bDataType; /* Defines of what datatype the entry is */ etisserant@539: UNS32 size; /* The size (in Byte) of the variable */ frdupin@71: void* pObject; /* This is the pointer of the Variable */ etisserant@0: } subindex; etisserant@0: etisserant@0: /** Struct for creating entries in the communictaion profile etisserant@0: */ etisserant@0: typedef struct td_indextable etisserant@0: { frdupin@71: subindex* pSubindex; /* Pointer to the subindex */ frdupin@71: UNS8 bSubCount; /* the count of valid entries for this subindex frdupin@71: * This count here defines how many memory has been frdupin@71: * allocated. this memory does not have to be used. frdupin@71: */ etisserant@0: UNS16 index; etisserant@0: } indextable; etisserant@0: etisserant@0: typedef struct s_quick_index{ etisserant@0: UNS16 SDO_SVR; etisserant@0: UNS16 SDO_CLT; etisserant@0: UNS16 PDO_RCV; etisserant@0: UNS16 PDO_RCV_MAP; etisserant@0: UNS16 PDO_TRS; etisserant@0: UNS16 PDO_TRS_MAP; etisserant@0: }quick_index; etisserant@0: etisserant@0: frdupin@71: /*typedef struct struct_CO_Data CO_Data; */ etisserant@0: typedef UNS32 (*ODCallback_t)(CO_Data* d, const indextable *, UNS8 bSubindex); etisserant@0: typedef const indextable * (*scanIndexOD_t)(UNS16 wIndex, UNS32 * errorCode, ODCallback_t **Callback); etisserant@0: etisserant@0: /************************** MACROS *********************************/ etisserant@0: frdupin@71: /* CANopen usefull helpers */ etisserant@449: #define GET_NODE_ID(m) (UNS16_LE(m.cob_id) & 0x7f) etisserant@449: #define GET_FUNCTION_CODE(m) (UNS16_LE(m.cob_id) >> 7) etisserant@0: frdupin@71: #endif /* __objdictdef_h__ */