- Better array initialization in data.h CANOPEN_NODE_DATA_INITIALIZER macro. Use a little hack with configure and config.h to create the "pure Ansi C" initializer.
- Workaround for the compiler compatibility with empty arrays (i.e. Index 1016).
- Some fixes in Makefile.in
/*
This file is part of CanFestival, a library implementing CanOpen Stack.
Copyright (C): Edouard TISSERANT and Francis DUPIN
See COPYING file for copyrights details.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __objdictdef_h__
#define __objdictdef_h__
/************************* CONSTANTES **********************************/
/** this are static defined datatypes taken fCODE the canopen standard. They
* are located at index 0x0001 to 0x001B. As described in the standard, they
* are in the object dictionary for definition purpose only. a device does not
* to support all of this datatypes.
*/
#define boolean 0x01
#define int8 0x02
#define int16 0x03
#define int32 0x04
#define uint8 0x05
#define uint16 0x06
#define uint32 0x07
#define real32 0x08
#define visible_string 0x09
#define octet_string 0x0A
#define unicode_string 0x0B
#define time_of_day 0x0C
#define time_difference 0x0D
#define domain 0x0F
#define int24 0x10
#define real64 0x11
#define int40 0x12
#define int48 0x13
#define int56 0x14
#define int64 0x15
#define uint24 0x16
#define uint40 0x18
#define uint48 0x19
#define uint56 0x1A
#define uint64 0x1B
#define pdo_communication_parameter 0x20
#define pdo_mapping 0x21
#define sdo_parameter 0x22
#define identity 0x23
/* CanFestival is using 0x24 to 0xFF to define some types containing a
value range (See how it works in objdict.c)
*/
/** definitions of the different types of PDOs' transmission
*
* SYNCHRO(n) means that the PDO will be transmited every n SYNC signal.
*/
#define TRANS_EVERY_N_SYNC(n) (n) /*n = 1 to 240 */
#define TRANS_SYNC_MIN 1 /* Trans after reception of n SYNC. n = 1 to 240 */
#define TRANS_SYNC_MAX 240 /* Trans after reception of n SYNC. n = 1 to 240 */
#define TRANS_RTR_SYNC 252 /* Transmission on request */
#define TRANS_RTR 253 /* Transmission on request */
#define TRANS_EVENT 255 /* Transmission on event */
/** Each entry of the object dictionary can be READONLY (RO), READ/WRITE (RW),
* WRITE-ONLY (WO)
*/
#define RW 0x00
#define WO 0x01
#define RO 0x02
#define TO_BE_SAVED 0x04
/************************ STRUCTURES ****************************/
/** This are some structs which are neccessary for creating the entries
* of the object dictionary.
*/
typedef struct td_subindex
{
UNS8 bAccessType;
UNS8 bDataType; /* Defines of what datatype the entry is */
UNS8 size; /* The size (in Byte) of the variable */
void* pObject; /* This is the pointer of the Variable */
} subindex;
/** Struct for creating entries in the communictaion profile
*/
typedef struct td_indextable
{
subindex* pSubindex; /* Pointer to the subindex */
UNS8 bSubCount; /* the count of valid entries for this subindex
* This count here defines how many memory has been
* allocated. this memory does not have to be used.
*/
UNS16 index;
} indextable;
typedef struct s_quick_index{
UNS16 SDO_SVR;
UNS16 SDO_CLT;
UNS16 PDO_RCV;
UNS16 PDO_RCV_MAP;
UNS16 PDO_TRS;
UNS16 PDO_TRS_MAP;
}quick_index;
/*typedef struct struct_CO_Data CO_Data; */
typedef UNS32 (*ODCallback_t)(CO_Data* d, const indextable *, UNS8 bSubindex);
typedef const indextable * (*scanIndexOD_t)(UNS16 wIndex, UNS32 * errorCode, ODCallback_t **Callback);
/************************** MACROS *********************************/
/* CANopen usefull helpers */
#define GET_NODE_ID(m) (m.cob_id.w & 0x7f)
#define GET_FUNCTION_CODE(m) (m.cob_id.w >> 7)
#endif /* __objdictdef_h__ */