Sam Grove / Mbed 2 deprecated canopen_masternode

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers objdictdef.h Source File

objdictdef.h

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 **********************************/
00027 /** this are static defined datatypes taken fCODE the canopen standard. They
00028  *  are located at index 0x0001 to 0x001B. As described in the standard, they
00029  *  are in the object dictionary for definition purpose only. a device does not
00030  *  to support all of this datatypes.
00031  */
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 /** Each entry of the object dictionary can be READONLY (RO), READ/WRITE (RW),
00071  *  WRITE-ONLY (WO)
00072  */
00073 #define RW     0x00  
00074 #define WO     0x01
00075 #define RO     0x02
00076 
00077 #define TO_BE_SAVE  0x04
00078 #define DCF_TO_SEND 0x08
00079 
00080 /************************ STRUCTURES ****************************/
00081 /** This are some structs which are neccessary for creating the entries
00082  *  of the object dictionary.
00083  */
00084 typedef struct td_subindex
00085 {
00086     UNS8                    bAccessType;
00087     UNS8                    bDataType; /* Defines of what datatype the entry is */
00088     UNS32                   size;      /* The size (in Byte) of the variable */
00089     void*                   pObject;   /* This is the pointer of the Variable */
00090 } subindex;
00091 
00092 /** Struct for creating entries in the communictaion profile
00093  */
00094 typedef struct td_indextable
00095 {
00096     subindex*   pSubindex;   /* Pointer to the subindex */
00097     UNS8   bSubCount;   /* the count of valid entries for this subindex
00098                          * This count here defines how many memory has been
00099                          * allocated. this memory does not have to be used.
00100                          */
00101     UNS16   index;
00102 } indextable;
00103 
00104 typedef struct s_quick_index{
00105     UNS16 SDO_SVR;
00106     UNS16 SDO_CLT;
00107     UNS16 PDO_RCV;
00108     UNS16 PDO_RCV_MAP;
00109     UNS16 PDO_TRS;
00110     UNS16 PDO_TRS_MAP;
00111 }quick_index;
00112 
00113 
00114 /*typedef struct struct_CO_Data CO_Data; */
00115 typedef UNS32 (*ODCallback_t)(CO_Data* d, const indextable *, UNS8 bSubindex);
00116 typedef const indextable * (*scanIndexOD_t)(UNS16 wIndex, UNS32 * errorCode, ODCallback_t **Callback);
00117 
00118 /************************** MACROS *********************************/
00119 
00120 /* CANopen usefull helpers */
00121 #define GET_NODE_ID(m)         (UNS16_LE(m.cob_id) & 0x7f)
00122 #define GET_FUNCTION_CODE(m)   (UNS16_LE(m.cob_id) >> 7)
00123 
00124 #endif /* __objdictdef_h__ */