Can_open_masternode

Dependencies:   mbed

Committer:
sam_grove
Date:
Mon May 30 07:36:47 2011 +0000
Revision:
0:9dd7c6129683
Initial public release of master node example

Who changed what in which revision?

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