Alex
9661838676
Работает. Есть CiA402, OD из SSC Tool. Автономный со своим main(). Проверялся тестами на SOEM.
496 lines
14 KiB
C
496 lines
14 KiB
C
/*
|
|
* This source file is part of the EtherCAT Slave Stack Code licensed by Beckhoff Automation GmbH & Co KG, 33415 Verl, Germany.
|
|
* The corresponding license agreement applies. This hint shall not be removed.
|
|
*/
|
|
|
|
/**
|
|
* \addtogroup F2838xCMEtherCATSlave F2838x CM EtherCAT Slave
|
|
* @{
|
|
*/
|
|
|
|
/**
|
|
\file F2838x CM EtherCAT SlaveObjects
|
|
\author ET9300Utilities.ApplicationHandler (Version 1.6.4.0) | EthercatSSC@beckhoff.com
|
|
|
|
\brief F2838x CM EtherCAT Slave specific objects<br>
|
|
\brief NOTE : This file will be overwritten if a new object dictionary is generated!<br>
|
|
*/
|
|
|
|
#if defined(_F2838X_CM_ETHER_CAT_SLAVE_) && (_F2838X_CM_ETHER_CAT_SLAVE_ == 1)
|
|
#define PROTO
|
|
#else
|
|
#define PROTO extern
|
|
#endif
|
|
/******************************************************************************
|
|
* Object 0x1600 : OutputMapping
|
|
******************************************************************************/
|
|
/**
|
|
* \addtogroup 0x1600 0x1600 | OutputMapping
|
|
* @{
|
|
* \brief Object 0x1600 (OutputMapping) definition
|
|
*/
|
|
#ifdef _OBJD_
|
|
/**
|
|
* \brief Object entry descriptions<br>
|
|
* <br>
|
|
* SubIndex 0<br>
|
|
* SubIndex 1 - map 0x7000 SIO 32bit<br>
|
|
* SubIndex 2 - map 0x7001 SIO 8bit<br>
|
|
* SubIndex 3 - 8bit padding<br>
|
|
*/
|
|
OBJCONST TSDOINFOENTRYDESC OBJMEM asEntryDesc0x1600[] = {
|
|
{ DEFTYPE_UNSIGNED8 , 0x8 , ACCESS_READ },
|
|
{ DEFTYPE_UNSIGNED32 , 0x20 , ACCESS_READ }, /* Subindex1 - map 0x7000 SIO 32bit */
|
|
{ DEFTYPE_UNSIGNED32 , 0x20 , ACCESS_READ }, /* Subindex2 - map 0x7001 SIO 8bit */
|
|
{ DEFTYPE_UNSIGNED32 , 0x20 , ACCESS_READ }}; /* Subindex3 - 8bit padding */
|
|
|
|
/**
|
|
* \brief Object/Entry names
|
|
*/
|
|
OBJCONST UCHAR OBJMEM aName0x1600[] = "OutputMapping\000"
|
|
"SubIndex 001\000"
|
|
"SubIndex 002\000"
|
|
"SubIndex 003\000\377";
|
|
#endif //#ifdef _OBJD_
|
|
|
|
#ifndef _F2838X_CM_ETHER_CAT_SLAVE_OBJECTS_H_
|
|
/**
|
|
* \brief Object structure
|
|
*/
|
|
typedef struct OBJ_STRUCT_PACKED_START {
|
|
UINT16 u16SubIndex0;
|
|
UINT32 SI1; /* Subindex1 - map 0x7000 SIO 32bit */
|
|
UINT32 SI2; /* Subindex2 - map 0x7001 SIO 8bit */
|
|
UINT32 SI3; /* Subindex3 - 8bit padding */
|
|
} OBJ_STRUCT_PACKED_END
|
|
TOBJ1600;
|
|
#endif //#ifndef _F2838X_CM_ETHER_CAT_SLAVE_OBJECTS_H_
|
|
|
|
/**
|
|
* \brief Object variable
|
|
*/
|
|
PROTO TOBJ1600 OutputMapping0x1600
|
|
#if defined(_F2838X_CM_ETHER_CAT_SLAVE_) && (_F2838X_CM_ETHER_CAT_SLAVE_ == 1)
|
|
={3,0x70000020,0x70010008,0x00000008}
|
|
#endif
|
|
;
|
|
/** @}*/
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
* Object 0x1A00 : InputMapping
|
|
******************************************************************************/
|
|
/**
|
|
* \addtogroup 0x1A00 0x1A00 | InputMapping
|
|
* @{
|
|
* \brief Object 0x1A00 (InputMapping) definition
|
|
*/
|
|
#ifdef _OBJD_
|
|
/**
|
|
* \brief Object entry descriptions<br>
|
|
* <br>
|
|
* SubIndex 0<br>
|
|
* SubIndex 1 - map SI 0bit<br>
|
|
* SubIndex 2 - 8bit padding<br>
|
|
* SubIndex 3 - map 0x6001 SIO 16bit<br>
|
|
*/
|
|
OBJCONST TSDOINFOENTRYDESC OBJMEM asEntryDesc0x1A00[] = {
|
|
{ DEFTYPE_UNSIGNED8 , 0x8 , ACCESS_READ },
|
|
{ DEFTYPE_UNSIGNED32 , 0x20 , ACCESS_READ }, /* Subindex1 - map SI 0bit */
|
|
{ DEFTYPE_UNSIGNED32 , 0x20 , ACCESS_READ }, /* Subindex2 - 8bit padding */
|
|
{ DEFTYPE_UNSIGNED32 , 0x20 , ACCESS_READ }}; /* Subindex3 - map 0x6001 SIO 16bit */
|
|
|
|
/**
|
|
* \brief Object/Entry names
|
|
*/
|
|
OBJCONST UCHAR OBJMEM aName0x1A00[] = "InputMapping\000"
|
|
"SubIndex 001\000"
|
|
"SubIndex 002\000"
|
|
"SubIndex 003\000\377";
|
|
#endif //#ifdef _OBJD_
|
|
|
|
#ifndef _F2838X_CM_ETHER_CAT_SLAVE_OBJECTS_H_
|
|
/**
|
|
* \brief Object structure
|
|
*/
|
|
typedef struct OBJ_STRUCT_PACKED_START {
|
|
UINT16 u16SubIndex0;
|
|
UINT32 SI1; /* Subindex1 - map SI 0bit */
|
|
UINT32 SI2; /* Subindex2 - 8bit padding */
|
|
UINT32 SI3; /* Subindex3 - map 0x6001 SIO 16bit */
|
|
} OBJ_STRUCT_PACKED_END
|
|
TOBJ1A00;
|
|
#endif //#ifndef _F2838X_CM_ETHER_CAT_SLAVE_OBJECTS_H_
|
|
|
|
/**
|
|
* \brief Object variable
|
|
*/
|
|
PROTO TOBJ1A00 InputMapping0x1A00
|
|
#if defined(_F2838X_CM_ETHER_CAT_SLAVE_) && (_F2838X_CM_ETHER_CAT_SLAVE_ == 1)
|
|
={3,0x60000008,0x00000008,0x60010010}
|
|
#endif
|
|
;
|
|
/** @}*/
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
* Object 0x1C12 : Obj0x1C12
|
|
******************************************************************************/
|
|
/**
|
|
* \addtogroup 0x1C12 0x1C12 | Obj0x1C12
|
|
* @{
|
|
* \brief Object 0x1C12 (Obj0x1C12) definition
|
|
*/
|
|
#ifdef _OBJD_
|
|
/**
|
|
* \brief Entry descriptions<br>
|
|
*
|
|
* Subindex 0<br>
|
|
* Subindex 1 - n (the same entry description is used)<br>
|
|
*/
|
|
OBJCONST TSDOINFOENTRYDESC OBJMEM asEntryDesc0x1C12[] = {
|
|
{ DEFTYPE_UNSIGNED8 , 0x8 , ACCESS_READ },
|
|
{ DEFTYPE_UNSIGNED16 , 0x10 , ACCESS_READ }};
|
|
|
|
/**
|
|
* \brief Object name definition<br>
|
|
* For Subindex 1 to n the syntax 'Subindex XXX' is used
|
|
*/
|
|
OBJCONST UCHAR OBJMEM aName0x1C12[] = "Obj0x1C12\000\377";
|
|
#endif //#ifdef _OBJD_
|
|
|
|
#ifndef _F2838X_CM_ETHER_CAT_SLAVE_OBJECTS_H_
|
|
/**
|
|
* \brief Object structure
|
|
*/
|
|
typedef struct OBJ_STRUCT_PACKED_START {
|
|
UINT16 u16SubIndex0; /**< \brief Subindex 0 */
|
|
UINT16 aEntries[1]; /**< \brief Subindex 1 - 1 */
|
|
} OBJ_STRUCT_PACKED_END
|
|
TOBJ1C12;
|
|
#endif //#ifndef _F2838X_CM_ETHER_CAT_SLAVE_OBJECTS_H_
|
|
|
|
/**
|
|
* \brief Object variable
|
|
*/
|
|
//PROTO TOBJ1C12 sRxPDOassign
|
|
//#if defined(_F2838X_CM_ETHER_CAT_SLAVE_) && (_F2838X_CM_ETHER_CAT_SLAVE_ == 1)
|
|
//={1,{0x1A00}}
|
|
//#endif
|
|
;
|
|
/** @}*/
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
* Object 0x1C13 : Obj0x1C13
|
|
******************************************************************************/
|
|
/**
|
|
* \addtogroup 0x1C13 0x1C13 | Obj0x1C13
|
|
* @{
|
|
* \brief Object 0x1C13 (Obj0x1C13) definition
|
|
*/
|
|
#ifdef _OBJD_
|
|
/**
|
|
* \brief Entry descriptions<br>
|
|
*
|
|
* Subindex 0<br>
|
|
* Subindex 1 - n (the same entry description is used)<br>
|
|
*/
|
|
OBJCONST TSDOINFOENTRYDESC OBJMEM asEntryDesc0x1C13[] = {
|
|
{ DEFTYPE_UNSIGNED8 , 0x8 , ACCESS_READ },
|
|
{ DEFTYPE_UNSIGNED16 , 0x10 , ACCESS_READ }};
|
|
|
|
/**
|
|
* \brief Object name definition<br>
|
|
* For Subindex 1 to n the syntax 'Subindex XXX' is used
|
|
*/
|
|
OBJCONST UCHAR OBJMEM aName0x1C13[] = "Obj0x1C13\000\377";
|
|
#endif //#ifdef _OBJD_
|
|
|
|
#ifndef _F2838X_CM_ETHER_CAT_SLAVE_OBJECTS_H_
|
|
/**
|
|
* \brief Object structure
|
|
*/
|
|
typedef struct OBJ_STRUCT_PACKED_START {
|
|
UINT16 u16SubIndex0; /**< \brief Subindex 0 */
|
|
UINT16 aEntries[1]; /**< \brief Subindex 1 - 1 */
|
|
} OBJ_STRUCT_PACKED_END
|
|
TOBJ1C13;
|
|
#endif //#ifndef _F2838X_CM_ETHER_CAT_SLAVE_OBJECTS_H_
|
|
|
|
/**
|
|
* \brief Object variable
|
|
*/
|
|
//PROTO TOBJ1C13 sTxPDOassign
|
|
//#if defined(_F2838X_CM_ETHER_CAT_SLAVE_) && (_F2838X_CM_ETHER_CAT_SLAVE_ == 1)
|
|
//={1,{0x1600}}
|
|
//#endif
|
|
;
|
|
/** @}*/
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
* Object 0x6000 : DummyInput1
|
|
******************************************************************************/
|
|
/**
|
|
* \addtogroup 0x6000 0x6000 | DummyInput1
|
|
* @{
|
|
* \brief Object 0x6000 (DummyInput1) definition
|
|
*/
|
|
#ifdef _OBJD_
|
|
/**
|
|
* \brief Entry description
|
|
*/
|
|
OBJCONST TSDOINFOENTRYDESC OBJMEM sEntryDesc0x6000 = { DEFTYPE_UNSIGNED8 , 0x08 , ACCESS_READ };
|
|
/**
|
|
* \brief Object name
|
|
*/
|
|
OBJCONST UCHAR OBJMEM aName0x6000[] = "DummyInput1\000\377";
|
|
#endif //#ifdef _OBJD_
|
|
|
|
/**
|
|
* \brief Object variable
|
|
*/
|
|
PROTO UINT8 DummyInput10x6000;
|
|
/** @}*/
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
* Object 0x6001 : DummyInput2
|
|
******************************************************************************/
|
|
/**
|
|
* \addtogroup 0x6001 0x6001 | DummyInput2
|
|
* @{
|
|
* \brief Object 0x6001 (DummyInput2) definition
|
|
*/
|
|
#ifdef _OBJD_
|
|
/**
|
|
* \brief Entry description
|
|
*/
|
|
OBJCONST TSDOINFOENTRYDESC OBJMEM sEntryDesc0x6001 = { DEFTYPE_UNSIGNED16 , 0x10 , ACCESS_READ };
|
|
/**
|
|
* \brief Object name
|
|
*/
|
|
OBJCONST UCHAR OBJMEM aName0x6001[] = "DummyInput2\000\377";
|
|
#endif //#ifdef _OBJD_
|
|
|
|
/**
|
|
* \brief Object variable
|
|
*/
|
|
PROTO UINT16 DummyInput20x6001;
|
|
/** @}*/
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
* Object 0x7000 : DummyOutput1
|
|
******************************************************************************/
|
|
/**
|
|
* \addtogroup 0x7000 0x7000 | DummyOutput1
|
|
* @{
|
|
* \brief Object 0x7000 (DummyOutput1) definition
|
|
*/
|
|
#ifdef _OBJD_
|
|
/**
|
|
* \brief Entry description
|
|
*/
|
|
OBJCONST TSDOINFOENTRYDESC OBJMEM sEntryDesc0x7000 = { DEFTYPE_UNSIGNED32 , 0x20 , ACCESS_READWRITE };
|
|
/**
|
|
* \brief Object name
|
|
*/
|
|
OBJCONST UCHAR OBJMEM aName0x7000[] = "DummyOutput1\000\377";
|
|
#endif //#ifdef _OBJD_
|
|
|
|
/**
|
|
* \brief Object variable
|
|
*/
|
|
PROTO UINT32 DummyOutput10x7000;
|
|
/** @}*/
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
* Object 0x7001 : DummyPutput2
|
|
******************************************************************************/
|
|
/**
|
|
* \addtogroup 0x7001 0x7001 | DummyPutput2
|
|
* @{
|
|
* \brief Object 0x7001 (DummyPutput2) definition
|
|
*/
|
|
#ifdef _OBJD_
|
|
/**
|
|
* \brief Entry description
|
|
*/
|
|
OBJCONST TSDOINFOENTRYDESC OBJMEM sEntryDesc0x7001 = { DEFTYPE_UNSIGNED16 , 0x10 , ACCESS_READWRITE };
|
|
/**
|
|
* \brief Object name
|
|
*/
|
|
OBJCONST UCHAR OBJMEM aName0x7001[] = "DummyPutput2\000\377";
|
|
#endif //#ifdef _OBJD_
|
|
|
|
/**
|
|
* \brief Object variable
|
|
*/
|
|
PROTO UINT16 DummyPutput20x7001;
|
|
/** @}*/
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
* Object 0x9000 : Var1
|
|
******************************************************************************/
|
|
/**
|
|
* \addtogroup 0x9000 0x9000 | Var1
|
|
* @{
|
|
* \brief Object 0x9000 (Var1) definition
|
|
*/
|
|
#ifdef _OBJD_
|
|
/**
|
|
* \brief Entry description
|
|
*/
|
|
OBJCONST TSDOINFOENTRYDESC OBJMEM sEntryDesc0x9000 = { DEFTYPE_UNSIGNED16 , 0x10 , ACCESS_READ };
|
|
/**
|
|
* \brief Object name
|
|
*/
|
|
OBJCONST UCHAR OBJMEM aName0x9000[] = "Var1\000\377";
|
|
#endif //#ifdef _OBJD_
|
|
|
|
/**
|
|
* \brief Object variable
|
|
*/
|
|
PROTO UINT16 Var10x9000
|
|
#if defined(_F2838X_CM_ETHER_CAT_SLAVE_) && (_F2838X_CM_ETHER_CAT_SLAVE_ == 1)
|
|
= 0xAABB
|
|
#endif
|
|
;
|
|
/** @}*/
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
* Object 0x9001 : Var2
|
|
******************************************************************************/
|
|
/**
|
|
* \addtogroup 0x9001 0x9001 | Var2
|
|
* @{
|
|
* \brief Object 0x9001 (Var2) definition
|
|
*/
|
|
#ifdef _OBJD_
|
|
/**
|
|
* \brief Entry description
|
|
*/
|
|
OBJCONST TSDOINFOENTRYDESC OBJMEM sEntryDesc0x9001 = { DEFTYPE_UNSIGNED16 , 0x10 , ACCESS_READ };
|
|
/**
|
|
* \brief Object name
|
|
*/
|
|
OBJCONST UCHAR OBJMEM aName0x9001[] = "Var2\000\377";
|
|
#endif //#ifdef _OBJD_
|
|
|
|
/**
|
|
* \brief Object variable
|
|
*/
|
|
PROTO UINT16 Var20x9001
|
|
#if defined(_F2838X_CM_ETHER_CAT_SLAVE_) && (_F2838X_CM_ETHER_CAT_SLAVE_ == 1)
|
|
= 0xBBAA
|
|
#endif
|
|
;
|
|
/** @}*/
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
* Object 0xF000 : Obj0xF000
|
|
******************************************************************************/
|
|
/**
|
|
* \addtogroup 0xF000 0xF000 | Obj0xF000
|
|
* @{
|
|
* \brief Object 0xF000 (Obj0xF000) definition
|
|
*/
|
|
#ifdef _OBJD_
|
|
/**
|
|
* \brief Object entry descriptions<br>
|
|
* <br>
|
|
* SubIndex 0<br>
|
|
* SubIndex 1 - Value_1<br>
|
|
* SubIndex 2 - Value_2<br>
|
|
*/
|
|
OBJCONST TSDOINFOENTRYDESC OBJMEM asEntryDesc0xF000[] = {
|
|
{ DEFTYPE_UNSIGNED8 , 0x8 , ACCESS_READWRITE },
|
|
{ DEFTYPE_UNSIGNED16 , 0x10 , ACCESS_READWRITE }, /* Subindex1 - Value_1 */
|
|
{ DEFTYPE_UNSIGNED16 , 0x10 , ACCESS_READWRITE }}; /* Subindex2 - Value_2 */
|
|
|
|
/**
|
|
* \brief Object/Entry names
|
|
*/
|
|
OBJCONST UCHAR OBJMEM aName0xF000[] = "Obj0xF000\000"
|
|
"Value_1\000"
|
|
"Value_2\000\377";
|
|
#endif //#ifdef _OBJD_
|
|
|
|
#ifndef _F2838X_CM_ETHER_CAT_SLAVE_OBJECTS_H_
|
|
/**
|
|
* \brief Object structure
|
|
*/
|
|
typedef struct OBJ_STRUCT_PACKED_START {
|
|
UINT16 u16SubIndex0;
|
|
UINT16 Value_1; /* Subindex1 - Value_1 */
|
|
UINT16 Value_2; /* Subindex2 - Value_2 */
|
|
} OBJ_STRUCT_PACKED_END
|
|
TOBJF000;
|
|
#endif //#ifndef _F2838X_CM_ETHER_CAT_SLAVE_OBJECTS_H_
|
|
|
|
/**
|
|
* \brief Object variable
|
|
*/
|
|
PROTO TOBJF000 Obj0xF000
|
|
#if defined(_F2838X_CM_ETHER_CAT_SLAVE_) && (_F2838X_CM_ETHER_CAT_SLAVE_ == 1)
|
|
={2,0,0}
|
|
#endif
|
|
;
|
|
/** @}*/
|
|
|
|
|
|
|
|
|
|
|
|
PROTO UINT8 mySdoRead(UINT16 index, UINT8 subindex, UINT32 dataSize, UINT16 MBXMEM * pData, UINT8 bCompleteAccess);
|
|
PROTO UINT8 mySdoWrite(UINT16 index, UINT8 subindex, UINT32 dataSize, UINT16 MBXMEM * pData, UINT8 bCompleteAccess);
|
|
|
|
|
|
#ifdef _OBJD_
|
|
TOBJECT OBJMEM ApplicationObjDic[] = {
|
|
/* Object 0x1600 */
|
|
{NULL , NULL , 0x1600 , {DEFTYPE_PDOMAPPING , 3 | (OBJCODE_REC << 8)} , asEntryDesc0x1600 , aName0x1600 , &OutputMapping0x1600 , NULL , NULL , 0x0000 },
|
|
/* Object 0x1A00 */
|
|
{NULL , NULL , 0x1A00 , {DEFTYPE_PDOMAPPING , 3 | (OBJCODE_REC << 8)} , asEntryDesc0x1A00 , aName0x1A00 , &InputMapping0x1A00 , NULL , NULL , 0x0000 },
|
|
/* Object 0x1C12 */
|
|
{NULL , NULL , 0x1C12 , {DEFTYPE_UNSIGNED16 , 1 | (OBJCODE_ARR << 8)} , asEntryDesc0x1C12 , aName0x1C12 , &sRxPDOassign , NULL , NULL , 0x0000 },
|
|
/* Object 0x1C13 */
|
|
{NULL , NULL , 0x1C13 , {DEFTYPE_UNSIGNED16 , 1 | (OBJCODE_ARR << 8)} , asEntryDesc0x1C13 , aName0x1C13 , &sTxPDOassign , NULL , NULL , 0x0000 },
|
|
/* Object 0x6000 */
|
|
{NULL , NULL , 0x6000 , {DEFTYPE_UNSIGNED8 , 0 | (OBJCODE_VAR << 8)} , &sEntryDesc0x6000 , aName0x6000 , &DummyInput10x6000 , NULL , NULL , 0x0000 },
|
|
/* Object 0x6001 */
|
|
{NULL , NULL , 0x6001 , {DEFTYPE_UNSIGNED16 , 0 | (OBJCODE_VAR << 8)} , &sEntryDesc0x6001 , aName0x6001 , &DummyInput20x6001 , NULL , NULL , 0x0000 },
|
|
/* Object 0x7000 */
|
|
{NULL , NULL , 0x7000 , {DEFTYPE_UNSIGNED32 , 0 | (OBJCODE_VAR << 8)} , &sEntryDesc0x7000 , aName0x7000 , &DummyOutput10x7000 , NULL , NULL , 0x0000 },
|
|
/* Object 0x7001 */
|
|
{NULL , NULL , 0x7001 , {DEFTYPE_UNSIGNED16 , 0 | (OBJCODE_VAR << 8)} , &sEntryDesc0x7001 , aName0x7001 , &DummyPutput20x7001 , NULL , NULL , 0x0000 },
|
|
/* Object 0x9000 */
|
|
{NULL , NULL , 0x9000 , {DEFTYPE_UNSIGNED16 , 0 | (OBJCODE_VAR << 8)} , &sEntryDesc0x9000 , aName0x9000 , &Var10x9000 , mySdoRead , NULL , 0x0000 },
|
|
/* Object 0x9001 */
|
|
{NULL , NULL , 0x9001 , {DEFTYPE_UNSIGNED16 , 0 | (OBJCODE_VAR << 8)} , &sEntryDesc0x9001 , aName0x9001 , &Var20x9001 , NULL , mySdoWrite , 0x0000 },
|
|
/* Object 0xF000 */
|
|
{NULL , NULL , 0xF000 , {DEFTYPE_RECORD , 2 | (OBJCODE_REC << 8)} , asEntryDesc0xF000 , aName0xF000 , &Obj0xF000 , NULL , NULL , 0x0000 },
|
|
{NULL,NULL, 0xFFFF, {0, 0}, NULL, NULL, NULL, NULL}};
|
|
#endif //#ifdef _OBJD_
|
|
|
|
#undef PROTO
|
|
|
|
/** @}*/
|
|
#define _F2838X_CM_ETHER_CAT_SLAVE_OBJECTS_H_
|