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