AB&T / SOEM

Dependents:   EasyCAT_LAB_simple EasyCAT_LAB_very_simple EasyCAT_LAB

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ethercatsoe.h Source File

ethercatsoe.h

Go to the documentation of this file.
00001 /*
00002  * Licensed under the GNU General Public License version 2 with exceptions. See
00003  * LICENSE file in the project root for full license information
00004  */
00005 
00006 /** \file
00007  * \brief
00008  * Headerfile for ethercatsoe.c
00009  */
00010 
00011 #ifndef _ethercatsoe_
00012 #define _ethercatsoe_
00013 
00014 #ifdef __cplusplus
00015 extern "C"
00016 {
00017 #endif
00018 
00019 #define EC_SOE_DATASTATE_B   0x01
00020 #define EC_SOE_NAME_B        0x02
00021 #define EC_SOE_ATTRIBUTE_B   0x04
00022 #define EC_SOE_UNIT_B        0x08
00023 #define EC_SOE_MIN_B         0x10
00024 #define EC_SOE_MAX_B         0x20
00025 #define EC_SOE_VALUE_B       0x40
00026 #define EC_SOE_DEFAULT_B     0x80
00027 
00028 #define EC_SOE_MAXNAME       60
00029 #define EC_SOE_MAXMAPPING    64
00030 
00031 #define EC_IDN_MDTCONFIG     24
00032 #define EC_IDN_ATCONFIG      16
00033 
00034 /** SoE name structure */
00035 PACKED_BEGIN
00036 typedef struct PACKED
00037 {
00038    /** current length in bytes of list */
00039    uint16     currentlength;
00040    /** maximum length in bytes of list */
00041    uint16     maxlength;
00042    char       name[EC_SOE_MAXNAME];
00043 } ec_SoEnamet;
00044 PACKED_END
00045 
00046 /** SoE list structure */
00047 PACKED_BEGIN
00048 typedef struct PACKED
00049 {
00050    /** current length in bytes of list */
00051    uint16     currentlength;
00052    /** maximum length in bytes of list */
00053    uint16     maxlength;
00054    union
00055    {
00056       uint8   byte[8];
00057       uint16  word[4];
00058       uint32  dword[2];
00059       uint64  lword[1];
00060    };
00061 } ec_SoElistt;
00062 PACKED_END
00063 
00064 /** SoE IDN mapping structure */
00065 PACKED_BEGIN
00066 typedef struct PACKED
00067 {
00068    /** current length in bytes of list */
00069    uint16     currentlength;
00070    /** maximum length in bytes of list */
00071    uint16     maxlength;
00072    uint16     idn[EC_SOE_MAXMAPPING];
00073 } ec_SoEmappingt;
00074 PACKED_END
00075 
00076 #define EC_SOE_LENGTH_1         0x00
00077 #define EC_SOE_LENGTH_2         0x01
00078 #define EC_SOE_LENGTH_4         0x02
00079 #define EC_SOE_LENGTH_8         0x03
00080 #define EC_SOE_TYPE_BINARY      0x00
00081 #define EC_SOE_TYPE_UINT        0x01
00082 #define EC_SOE_TYPE_INT         0x02
00083 #define EC_SOE_TYPE_HEX         0x03
00084 #define EC_SOE_TYPE_STRING      0x04
00085 #define EC_SOE_TYPE_IDN         0x05
00086 #define EC_SOE_TYPE_FLOAT       0x06
00087 #define EC_SOE_TYPE_PARAMETER   0x07
00088 
00089 /** SoE attribute structure */
00090 PACKED_BEGIN
00091 typedef struct PACKED
00092 {
00093    /** evaluation factor for display purposes */
00094    uint32     evafactor   :16;
00095    /** length of IDN element(s) */
00096    uint32     length      :2;
00097    /** IDN is list */
00098    uint32     list        :1;
00099    /** IDN is command */
00100    uint32     command     :1;
00101    /** datatype */
00102    uint32     datatype    :3;
00103    uint32     reserved1   :1;
00104    /** decimals to display if float datatype */
00105    uint32     decimals    :4;
00106    /** write protected in pre-op */
00107    uint32     wppreop     :1;
00108    /** write protected in safe-op */
00109    uint32     wpsafeop    :1;
00110    /** write protected in op */
00111    uint32     wpop        :1;
00112    uint32     reserved2   :1;
00113 } ec_SoEattributet;
00114 PACKED_END
00115 
00116 #ifdef EC_VER1
00117 int ec_SoEread(uint16 slave, uint8 driveNo, uint8 elementflags, uint16 idn, int *psize, void *p, int timeout);
00118 int ec_SoEwrite(uint16 slave, uint8 driveNo, uint8 elementflags, uint16 idn, int psize, void *p, int timeout);
00119 int ec_readIDNmap(uint16 slave, int *Osize, int *Isize);
00120 #endif
00121 
00122 int ecx_SoEread(ecx_contextt *context, uint16 slave, uint8 driveNo, uint8 elementflags, uint16 idn, int *psize, void *p, int timeout);
00123 int ecx_SoEwrite(ecx_contextt *context, uint16 slave, uint8 driveNo, uint8 elementflags, uint16 idn, int psize, void *p, int timeout);
00124 int ecx_readIDNmap(ecx_contextt *context, uint16 slave, int *Osize, int *Isize);
00125 
00126 #ifdef __cplusplus
00127 }
00128 #endif
00129 
00130 #endif