![](/media/cache/profiles/IMG_2753.JPG.50x50_q85.jpg)
Can_open_slavenode
framework/include/objdictdef.h@0:6219434a0cb5, 2011-05-30 (annotated)
- Committer:
- sam_grove
- Date:
- Mon May 30 07:14:41 2011 +0000
- Revision:
- 0:6219434a0cb5
Initial public release of slave node framework port
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sam_grove |
0:6219434a0cb5 | 1 | /* |
sam_grove |
0:6219434a0cb5 | 2 | This file is part of CanFestival, a library implementing CanOpen Stack. |
sam_grove |
0:6219434a0cb5 | 3 | |
sam_grove |
0:6219434a0cb5 | 4 | Copyright (C): Edouard TISSERANT and Francis DUPIN |
sam_grove |
0:6219434a0cb5 | 5 | |
sam_grove |
0:6219434a0cb5 | 6 | See COPYING file for copyrights details. |
sam_grove |
0:6219434a0cb5 | 7 | |
sam_grove |
0:6219434a0cb5 | 8 | This library is free software; you can redistribute it and/or |
sam_grove |
0:6219434a0cb5 | 9 | modify it under the terms of the GNU Lesser General Public |
sam_grove |
0:6219434a0cb5 | 10 | License as published by the Free Software Foundation; either |
sam_grove |
0:6219434a0cb5 | 11 | version 2.1 of the License, or (at your option) any later version. |
sam_grove |
0:6219434a0cb5 | 12 | |
sam_grove |
0:6219434a0cb5 | 13 | This library is distributed in the hope that it will be useful, |
sam_grove |
0:6219434a0cb5 | 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
sam_grove |
0:6219434a0cb5 | 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
sam_grove |
0:6219434a0cb5 | 16 | Lesser General Public License for more details. |
sam_grove |
0:6219434a0cb5 | 17 | |
sam_grove |
0:6219434a0cb5 | 18 | You should have received a copy of the GNU Lesser General Public |
sam_grove |
0:6219434a0cb5 | 19 | License along with this library; if not, write to the Free Software |
sam_grove |
0:6219434a0cb5 | 20 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
sam_grove |
0:6219434a0cb5 | 21 | */ |
sam_grove |
0:6219434a0cb5 | 22 | |
sam_grove |
0:6219434a0cb5 | 23 | #ifndef __objdictdef_h__ |
sam_grove |
0:6219434a0cb5 | 24 | #define __objdictdef_h__ |
sam_grove |
0:6219434a0cb5 | 25 | |
sam_grove |
0:6219434a0cb5 | 26 | /************************* CONSTANTES **********************************/ |
sam_grove |
0:6219434a0cb5 | 27 | /** this are static defined datatypes taken fCODE the canopen standard. They |
sam_grove |
0:6219434a0cb5 | 28 | * are located at index 0x0001 to 0x001B. As described in the standard, they |
sam_grove |
0:6219434a0cb5 | 29 | * are in the object dictionary for definition purpose only. a device does not |
sam_grove |
0:6219434a0cb5 | 30 | * to support all of this datatypes. |
sam_grove |
0:6219434a0cb5 | 31 | */ |
sam_grove |
0:6219434a0cb5 | 32 | #define boolean 0x01 |
sam_grove |
0:6219434a0cb5 | 33 | #define int8 0x02 |
sam_grove |
0:6219434a0cb5 | 34 | #define int16 0x03 |
sam_grove |
0:6219434a0cb5 | 35 | #define int32 0x04 |
sam_grove |
0:6219434a0cb5 | 36 | #define uint8 0x05 |
sam_grove |
0:6219434a0cb5 | 37 | #define uint16 0x06 |
sam_grove |
0:6219434a0cb5 | 38 | #define uint32 0x07 |
sam_grove |
0:6219434a0cb5 | 39 | #define real32 0x08 |
sam_grove |
0:6219434a0cb5 | 40 | #define visible_string 0x09 |
sam_grove |
0:6219434a0cb5 | 41 | #define octet_string 0x0A |
sam_grove |
0:6219434a0cb5 | 42 | #define unicode_string 0x0B |
sam_grove |
0:6219434a0cb5 | 43 | #define time_of_day 0x0C |
sam_grove |
0:6219434a0cb5 | 44 | #define time_difference 0x0D |
sam_grove |
0:6219434a0cb5 | 45 | |
sam_grove |
0:6219434a0cb5 | 46 | #define domain 0x0F |
sam_grove |
0:6219434a0cb5 | 47 | #define int24 0x10 |
sam_grove |
0:6219434a0cb5 | 48 | #define real64 0x11 |
sam_grove |
0:6219434a0cb5 | 49 | #define int40 0x12 |
sam_grove |
0:6219434a0cb5 | 50 | #define int48 0x13 |
sam_grove |
0:6219434a0cb5 | 51 | #define int56 0x14 |
sam_grove |
0:6219434a0cb5 | 52 | #define int64 0x15 |
sam_grove |
0:6219434a0cb5 | 53 | #define uint24 0x16 |
sam_grove |
0:6219434a0cb5 | 54 | |
sam_grove |
0:6219434a0cb5 | 55 | #define uint40 0x18 |
sam_grove |
0:6219434a0cb5 | 56 | #define uint48 0x19 |
sam_grove |
0:6219434a0cb5 | 57 | #define uint56 0x1A |
sam_grove |
0:6219434a0cb5 | 58 | #define uint64 0x1B |
sam_grove |
0:6219434a0cb5 | 59 | |
sam_grove |
0:6219434a0cb5 | 60 | #define pdo_communication_parameter 0x20 |
sam_grove |
0:6219434a0cb5 | 61 | #define pdo_mapping 0x21 |
sam_grove |
0:6219434a0cb5 | 62 | #define sdo_parameter 0x22 |
sam_grove |
0:6219434a0cb5 | 63 | #define identity 0x23 |
sam_grove |
0:6219434a0cb5 | 64 | |
sam_grove |
0:6219434a0cb5 | 65 | /* CanFestival is using 0x24 to 0xFF to define some types containing a |
sam_grove |
0:6219434a0cb5 | 66 | value range (See how it works in objdict.c) |
sam_grove |
0:6219434a0cb5 | 67 | */ |
sam_grove |
0:6219434a0cb5 | 68 | |
sam_grove |
0:6219434a0cb5 | 69 | |
sam_grove |
0:6219434a0cb5 | 70 | /** Each entry of the object dictionary can be READONLY (RO), READ/WRITE (RW), |
sam_grove |
0:6219434a0cb5 | 71 | * WRITE-ONLY (WO) |
sam_grove |
0:6219434a0cb5 | 72 | */ |
sam_grove |
0:6219434a0cb5 | 73 | #define RW 0x00 |
sam_grove |
0:6219434a0cb5 | 74 | #define WO 0x01 |
sam_grove |
0:6219434a0cb5 | 75 | #define RO 0x02 |
sam_grove |
0:6219434a0cb5 | 76 | |
sam_grove |
0:6219434a0cb5 | 77 | #define TO_BE_SAVE 0x04 |
sam_grove |
0:6219434a0cb5 | 78 | #define DCF_TO_SEND 0x08 |
sam_grove |
0:6219434a0cb5 | 79 | |
sam_grove |
0:6219434a0cb5 | 80 | /************************ STRUCTURES ****************************/ |
sam_grove |
0:6219434a0cb5 | 81 | /** This are some structs which are neccessary for creating the entries |
sam_grove |
0:6219434a0cb5 | 82 | * of the object dictionary. |
sam_grove |
0:6219434a0cb5 | 83 | */ |
sam_grove |
0:6219434a0cb5 | 84 | typedef struct td_subindex |
sam_grove |
0:6219434a0cb5 | 85 | { |
sam_grove |
0:6219434a0cb5 | 86 | UNS8 bAccessType; |
sam_grove |
0:6219434a0cb5 | 87 | UNS8 bDataType; /* Defines of what datatype the entry is */ |
sam_grove |
0:6219434a0cb5 | 88 | UNS32 size; /* The size (in Byte) of the variable */ |
sam_grove |
0:6219434a0cb5 | 89 | void* pObject; /* This is the pointer of the Variable */ |
sam_grove |
0:6219434a0cb5 | 90 | } subindex; |
sam_grove |
0:6219434a0cb5 | 91 | |
sam_grove |
0:6219434a0cb5 | 92 | /** Struct for creating entries in the communictaion profile |
sam_grove |
0:6219434a0cb5 | 93 | */ |
sam_grove |
0:6219434a0cb5 | 94 | typedef struct td_indextable |
sam_grove |
0:6219434a0cb5 | 95 | { |
sam_grove |
0:6219434a0cb5 | 96 | subindex* pSubindex; /* Pointer to the subindex */ |
sam_grove |
0:6219434a0cb5 | 97 | UNS8 bSubCount; /* the count of valid entries for this subindex |
sam_grove |
0:6219434a0cb5 | 98 | * This count here defines how many memory has been |
sam_grove |
0:6219434a0cb5 | 99 | * allocated. this memory does not have to be used. |
sam_grove |
0:6219434a0cb5 | 100 | */ |
sam_grove |
0:6219434a0cb5 | 101 | UNS16 index; |
sam_grove |
0:6219434a0cb5 | 102 | } indextable; |
sam_grove |
0:6219434a0cb5 | 103 | |
sam_grove |
0:6219434a0cb5 | 104 | typedef struct s_quick_index{ |
sam_grove |
0:6219434a0cb5 | 105 | UNS16 SDO_SVR; |
sam_grove |
0:6219434a0cb5 | 106 | UNS16 SDO_CLT; |
sam_grove |
0:6219434a0cb5 | 107 | UNS16 PDO_RCV; |
sam_grove |
0:6219434a0cb5 | 108 | UNS16 PDO_RCV_MAP; |
sam_grove |
0:6219434a0cb5 | 109 | UNS16 PDO_TRS; |
sam_grove |
0:6219434a0cb5 | 110 | UNS16 PDO_TRS_MAP; |
sam_grove |
0:6219434a0cb5 | 111 | }quick_index; |
sam_grove |
0:6219434a0cb5 | 112 | |
sam_grove |
0:6219434a0cb5 | 113 | |
sam_grove |
0:6219434a0cb5 | 114 | /*typedef struct struct_CO_Data CO_Data; */ |
sam_grove |
0:6219434a0cb5 | 115 | typedef UNS32 (*ODCallback_t)(CO_Data* d, const indextable *, UNS8 bSubindex); |
sam_grove |
0:6219434a0cb5 | 116 | typedef const indextable * (*scanIndexOD_t)(UNS16 wIndex, UNS32 * errorCode, ODCallback_t **Callback); |
sam_grove |
0:6219434a0cb5 | 117 | |
sam_grove |
0:6219434a0cb5 | 118 | /************************** MACROS *********************************/ |
sam_grove |
0:6219434a0cb5 | 119 | |
sam_grove |
0:6219434a0cb5 | 120 | /* CANopen usefull helpers */ |
sam_grove |
0:6219434a0cb5 | 121 | #define GET_NODE_ID(m) (UNS16_LE(m.cob_id) & 0x7f) |
sam_grove |
0:6219434a0cb5 | 122 | #define GET_FUNCTION_CODE(m) (UNS16_LE(m.cob_id) >> 7) |
sam_grove |
0:6219434a0cb5 | 123 | |
sam_grove |
0:6219434a0cb5 | 124 | #endif /* __objdictdef_h__ */ |