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