www.pudn.com > ethercat-slave-source-code.rar > ecatcoe.h, change:2013-05-03,size:4084b


/** 
 * \addtogroup CoE CAN Application Profile over EtherCAT 
 * @{ 
 */ 
 
/** 
\file ecatcoe.h 
\author EthercatSSC@beckhoff.com 
 
\version 5.01 
 
<br>Changes to version - :<br> 
V5.01 : Start file change log 
 */ 
#ifndef _ECATCOE_H_ 
 
#define _ECATCOE_H_ 
 
/*----------------------------------------------------------------------------------------- 
------ 
------    Includes 
------ 
-----------------------------------------------------------------------------------------*/ 
#include "mailbox.h" 
 
/*----------------------------------------------------------------------------------------- 
------ 
------    Defines and Types 
------ 
-----------------------------------------------------------------------------------------*/ 
 
/*--------------------------------------------- 
-    Error codes 
-----------------------------------------------*/ 
#define     ERROR_COEINVALIDSERVICE     0x01 /**< \brief Invalid SDO service*/ 
#define     ERROR_COENOTSUPPORTED       0x02 /**< \brief Not supported service*/ 
 
 
/*--------------------------------------------- 
-    COE services 
-----------------------------------------------*/ 
#define     COESERVICE_EMERGENCY        0x01 /**< \brief CoE Emergency*/ 
#define     COESERVICE_SDOREQUEST       0x02 /**< \brief CoE SDO request*/ 
#define     COESERVICE_SDORESPONSE      0x03 /**< \brief CoE SDO response*/ 
#define     COESERVICE_TXPDO            0x04 /**< \brief CoE TxPDO*/ 
#define     COESERVICE_RXPDO            0x05 /**< \brief CoE RxPDO*/ 
#define     COESERVICE_TXPDOREMREQ      0x06 /**< \brief CoE TxPDO map request*/ 
#define     COESERVICE_RXPDOREMREQ      0x07 /**< \brief CoE RxPDO map request*/ 
#define     COESERVICE_SDOINFO          0x08 /**< \brief CoE SDO Info*/ 
 
 
 
/*--------------------------------------------- 
-    COE Structures 
-----------------------------------------------*/ 
#if BIG_ENDIAN_FORMAT 
#define     COEHEADER_COESERVICESHIFT   4 /**< \brief CoE service shift (within CoE header)*/ 
#define     COEHEADER_COESERVICEMASK    0x00F0 /**< \brief CoE service mask (within CoE header)*/ 
#else 
#define     COEHEADER_COESERVICESHIFT   12 /**< \brief CoE service shift (within CoE header)*/ 
#define     COEHEADER_COESERVICEMASK    0xF000 /**< \brief CoE service mask (within CoE header)*/ 
#endif 
 
#define     COE_HEADER_SIZE             2 /**< \brief CoE header size*/ 
 
typedef UINT16 TCOEHEADER; /**< \brief CoE header*/ 
 
 
/** 
 * \brief CoE Mailbox header 
 */ 
typedef struct MBX_STRUCT_PACKED_START 
{ 
  TMBXHEADER        MbxHeader; /**< \brief mailbox header*/ 
  TCOEHEADER        CoeHeader; /**< \brief CoE header*/ 
  UINT16            Data[((MAX_MBX_DATA_SIZE)-(COE_HEADER_SIZE)) >> 1]; /**< \brief CoE data*/ 
}MBX_STRUCT_PACKED_END 
TCOEMBX; 
 
 
#endif //_ECATCOE_H_ 
 
#if _ECATCOE_ 
    #define PROTO 
#else 
    #define PROTO extern 
#endif 
 
/*----------------------------------------------------------------------------------------- 
------ 
------    Global Variables 
------ 
-----------------------------------------------------------------------------------------*/ 
PROTO    TMBX MBXMEM * VARMEM pCoeSendStored;                /** if the mailbox service could not be sent (or stored), 
                                                                the CoE service will be stored in this variable 
                                                                and will be sent automatically from the mailbox handler 
                                                                (COE_ContinueInd) when the send mailbox will be read 
                                                                the next time from the master */ 
 
/*----------------------------------------------------------------------------------------- 
------ 
------    Global Functions 
------ 
-----------------------------------------------------------------------------------------*/ 
 
PROTO   void     COE_Init(void); 
PROTO   UINT8    COE_ServiceInd(TCOEMBX MBXMEM *pCoeMbx); 
PROTO   void     COE_ContinueInd(TMBX MBXMEM * pMbx); 
 
#undef PROTO 
/** @}*/