ethercatsoe.h

Go to the documentation of this file.
00001 /*
00002  * Simple Open EtherCAT Master Library 
00003  *
00004  * File    : ethercatsoe.h
00005  * Version : 1.2.5
00006  * Date    : 09-04-2011
00007  * Copyright (C) 2005-2011 Speciaal Machinefabriek Ketels v.o.f.
00008  * Copyright (C) 2005-2011 Arthur Ketels
00009  * Copyright (C) 2008-2009 TU/e Technische Universiteit Eindhoven 
00010  *
00011  * SOEM is free software; you can redistribute it and/or modify it under
00012  * the terms of the GNU General Public License version 2 as published by the Free
00013  * Software Foundation.
00014  *
00015  * SOEM is distributed in the hope that it will be useful, but WITHOUT ANY
00016  * WARRANTY; without even the implied warranty of MERCHANTABILITY or
00017  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00018  * for more details.
00019  *
00020  * As a special exception, if other files instantiate templates or use macros
00021  * or inline functions from this file, or you compile this file and link it
00022  * with other works to produce a work based on this file, this file does not
00023  * by itself cause the resulting work to be covered by the GNU General Public
00024  * License. However the source code for this file must still be made available
00025  * in accordance with section (3) of the GNU General Public License.
00026    *
00027  * This exception does not invalidate any other reasons why a work based on
00028  * this file might be covered by the GNU General Public License.
00029  *
00030  * The EtherCAT Technology, the trade name and logo “EtherCAT” are the intellectual
00031  * property of, and protected by Beckhoff Automation GmbH. You can use SOEM for
00032  * the sole purpose of creating, using and/or selling or otherwise distributing
00033  * an EtherCAT network master provided that an EtherCAT Master License is obtained
00034  * from Beckhoff Automation GmbH.
00035  *
00036  * In case you did not receive a copy of the EtherCAT Master License along with
00037  * SOEM write to Beckhoff Automation GmbH, Eiserstraße 5, D-33415 Verl, Germany
00038  * (www.beckhoff.com).
00039    */
00040 
00041 /** \file 
00042  * \brief
00043  * Headerfile for ethercatsoe.c 
00044  */
00045 
00046 #ifndef _ethercatsoe_
00047 #define _ethercatsoe_
00048 
00049 #define EC_SOE_DATASTATE_B    0x01
00050 #define EC_SOE_NAME_B     0x02
00051 #define EC_SOE_ATTRIBUTE_B    0x04
00052 #define EC_SOE_UNIT_B     0x08
00053 #define EC_SOE_MIN_B      0x10
00054 #define EC_SOE_MAX_B      0x20
00055 #define EC_SOE_VALUE_B      0x40
00056 #define EC_SOE_DEFAULT_B    0x80
00057 
00058 #define EC_SOE_MAXNAME      60
00059 #define EC_SOE_MAXMAPPING   64
00060 
00061 #define EC_IDN_MDTCONFIG    24
00062 #define EC_IDN_ATCONFIG     16
00063 
00064 /** SoE name structure */
00065 typedef struct PACKED
00066 {
00067   /** current length in bytes of list */
00068   uint16    currentlength;
00069   /** maximum length in bytes of list */
00070   uint16    maxlength;
00071   char    name[EC_SOE_MAXNAME];
00072 } ec_SoEnamet;
00073 
00074 /** SoE list structure */
00075 typedef struct PACKED
00076 {
00077   /** current length in bytes of list */
00078   uint16    currentlength;
00079   /** maximum length in bytes of list */
00080   uint16    maxlength;
00081   union
00082   { 
00083     uint8 byte[8];
00084     uint16  word[4];
00085     uint32  dword[2];
00086     uint64  lword[1];
00087   };  
00088 } ec_SoElistt;
00089 
00090 /** SoE IDN mapping structure */
00091 typedef struct PACKED
00092 {
00093   /** current length in bytes of list */
00094   uint16    currentlength;
00095   /** maximum length in bytes of list */
00096   uint16    maxlength;
00097   uint16    idn[EC_SOE_MAXMAPPING];
00098 } ec_SoEmappingt;
00099 
00100 #define EC_SOE_LENGTH_1     0x00
00101 #define EC_SOE_LENGTH_2     0x01
00102 #define EC_SOE_LENGTH_4     0x02
00103 #define EC_SOE_LENGTH_8     0x03
00104 #define EC_SOE_TYPE_BINARY    0x00
00105 #define EC_SOE_TYPE_UINT    0x01
00106 #define EC_SOE_TYPE_INT     0x02
00107 #define EC_SOE_TYPE_HEX     0x03
00108 #define EC_SOE_TYPE_STRING    0x04
00109 #define EC_SOE_TYPE_IDN     0x05
00110 #define EC_SOE_TYPE_FLOAT   0x06
00111 #define EC_SOE_TYPE_PARAMETER 0x07
00112 
00113 /** SoE attribute structure */
00114 typedef struct PACKED
00115 {
00116   /** evaluation factor for display purposes */
00117   uint32    evafactor :16;
00118   /** length of IDN element(s) */
00119   uint32    length    :2;
00120   /** IDN is list */
00121   uint32    list    :1;
00122   /** IDN is command */
00123   uint32    command   :1;
00124   /** datatype */
00125   uint32    datatype  :3;
00126   uint32    reserved1 :1;
00127   /** decimals to display if float datatype */
00128   uint32    decimals  :4;
00129   /** write protected in pre-op */
00130   uint32    wppreop   :1;
00131   /** write protected in safe-op */
00132   uint32    wpsafeop  :1;
00133   /** write protected in op */
00134   uint32    wpop    :1;
00135   uint32    reserved2 :1;
00136 } ec_SoEattributet;
00137 
00138 int ec_SoEread(uint16 slave, uint8 driveNo, uint8 elementflags, uint16 idn, int *psize, void *p, int timeout);
00139 int ec_SoEwrite(uint16 slave, uint8 driveNo, uint8 elementflags, uint16 idn, int psize, void *p, int timeout);
00140 int ec_readIDNmap(uint16 slave, int *Osize, int *Isize);
00141 
00142 #endif
Generated by  doxygen 1.6.3