00001 /* 00002 This file is part of CanFestival, a library implementing CanOpen Stack. 00003 00004 Copyright (C): Edouard TISSERANT and Francis DUPIN 00005 00006 See COPYING file for copyrights details. 00007 00008 This library is free software; you can redistribute it and/or 00009 modify it under the terms of the GNU Lesser General Public 00010 License as published by the Free Software Foundation; either 00011 version 2.1 of the License, or (at your option) any later version. 00012 00013 This library is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 Lesser General Public License for more details. 00017 00018 You should have received a copy of the GNU Lesser General Public 00019 License along with this library; if not, write to the Free Software 00020 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00021 */ 00022 00023 #ifndef __objdictdef_h__ 00024 #define __objdictdef_h__ 00025 00026 /************************* CONSTANTES **********************************/ 00032 #define boolean 0x01 00033 #define int8 0x02 00034 #define int16 0x03 00035 #define int32 0x04 00036 #define uint8 0x05 00037 #define uint16 0x06 00038 #define uint32 0x07 00039 #define real32 0x08 00040 #define visible_string 0x09 00041 #define octet_string 0x0A 00042 #define unicode_string 0x0B 00043 #define time_of_day 0x0C 00044 #define time_difference 0x0D 00045 00046 #define domain 0x0F 00047 #define int24 0x10 00048 #define real64 0x11 00049 #define int40 0x12 00050 #define int48 0x13 00051 #define int56 0x14 00052 #define int64 0x15 00053 #define uint24 0x16 00054 00055 #define uint40 0x18 00056 #define uint48 0x19 00057 #define uint56 0x1A 00058 #define uint64 0x1B 00059 00060 #define pdo_communication_parameter 0x20 00061 #define pdo_mapping 0x21 00062 #define sdo_parameter 0x22 00063 #define identity 0x23 00064 00065 /* CanFestival is using 0x24 to 0xFF to define some types containing a 00066 value range (See how it works in objdict.c) 00067 */ 00068 00069 00070 00075 #define TRANS_EVERY_N_SYNC(n) (n) /*n = 1 to 240 */ 00076 #define TRANS_SYNC_MIN 1 /* Trans after reception of n SYNC. n = 1 to 240 */ 00077 #define TRANS_SYNC_MAX 240 /* Trans after reception of n SYNC. n = 1 to 240 */ 00078 #define TRANS_RTR_SYNC 252 /* Transmission on request */ 00079 #define TRANS_RTR 253 /* Transmission on request */ 00080 #define TRANS_EVENT 255 /* Transmission on event */ 00081 00085 #define RW 0x00 00086 #define WO 0x01 00087 #define RO 0x02 00088 00089 #define TO_BE_SAVE 0x04 00090 00091 /************************ STRUCTURES ****************************/ 00095 typedef struct td_subindex 00096 { 00097 UNS8 bAccessType; 00098 UNS8 bDataType; /* Defines of what datatype the entry is */ 00099 UNS8 size; /* The size (in Byte) of the variable */ 00100 void* pObject; /* This is the pointer of the Variable */ 00101 } subindex; 00102 00105 typedef struct td_indextable 00106 { 00107 subindex* pSubindex; /* Pointer to the subindex */ 00108 UNS8 bSubCount; /* the count of valid entries for this subindex 00109 * This count here defines how many memory has been 00110 * allocated. this memory does not have to be used. 00111 */ 00112 UNS16 index; 00113 } indextable; 00114 00115 typedef struct s_quick_index{ 00116 UNS16 SDO_SVR; 00117 UNS16 SDO_CLT; 00118 UNS16 PDO_RCV; 00119 UNS16 PDO_RCV_MAP; 00120 UNS16 PDO_TRS; 00121 UNS16 PDO_TRS_MAP; 00122 }quick_index; 00123 00124 00125 /*typedef struct struct_CO_Data CO_Data; */ 00126 typedef UNS32 (*ODCallback_t)(CO_Data* d, const indextable *, UNS8 bSubindex); 00127 typedef const indextable * (*scanIndexOD_t)(UNS16 wIndex, UNS32 * errorCode, ODCallback_t **Callback); 00128 00129 /************************** MACROS *********************************/ 00130 00131 /* CANopen usefull helpers */ 00132 #define GET_NODE_ID(m) (m.cob_id.w & 0x7f) 00133 #define GET_FUNCTION_CODE(m) (m.cob_id.w >> 7) 00134 00135 #endif /* __objdictdef_h__ */