ethercat_AL.h
Go to the documentation of this file.
00001 // $Id: ethercat_AL.h,v 1.15 2006/02/20 15:57:33 kgad Exp $
00002 //===========================================================================
00003 //      This file is part of "EtherCAT Master Library".
00004 //      Copyright (C) 2005 FMTC vzw, Diamant Building, A. Reyerslaan 80,
00005 //      B-1030 Brussels, Belgium.
00006 //
00007 //      EtherCAT Master Library is free software; you can redistribute it
00008 //      and/or modify it under the terms of the GNU General Public License
00009 //      as published by the Free Software Foundation; either version 2 or
00010 //      (at your option) any later version.
00011 //
00012 //      EtherCAT Master Code is distributed in the hope that it will be
00013 //      useful, but WITHOUT ANY WARRANTY; without even the implied
00014 //      warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00015 //      PURPOSE. See the GNU General Public License for more details.
00016 //
00017 //      You should have received a copy of the GNU General Public License
00018 //      along with the EtherCAT Master Library; if not, write to the Free
00019 //      Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00020 //      02111-1307 USA.
00021 //
00022 //      EtherCAT, the EtherCAT trade name and logo are the intellectual
00023 //      property of, and protected by Beckhoff. You can use "EtherCAT
00024 //      Master Library" for creating and/or selling or otherwise
00025 //      distributing an EtherCAT network master under the terms of the
00026 //      EtherCAT Master License.
00027 //
00028 //      You should have received a copy of the EtherCAT Master License
00029 //      along with the EtherCAT Master Library; if not, write to Beckhoff
00030 //      Automation GmbH, Eiserstrasse 5, D-33415 Verl, Germany.
00031 //===========================================================================
00032 
00033 #ifndef __ethercat_al__
00034 #define __ethercat_al__
00035 
00036 #include "ros_ethercat_eml/ethercat_defs.h"
00037 
00038 // forward declaration
00039 class EtherCAT_DataLinkLayer;
00040 class EtherCAT_SlaveHandler;
00041 class EC_FixedStationAddress;
00042 class EtherCAT_PD_Buffer;
00043 
00045 
00048 inline uint16_t ringpos2adp(uint16_t ringpos)
00049 {
00050   return (uint16_t) (0x0000 - ringpos);
00051 }
00052 
00054 
00057 inline uint16_t adp2ringpos(uint16_t adp)
00058 {
00059   return (uint16_t) (0x0000 - adp);
00060 }
00061 
00063 
00066 class EC_Logic
00067 {
00068 public:
00069   EC_Logic() : m_wkc(0), m_idx(0)
00070   {
00071   }
00072 
00074   uint8_t get_idx();
00076   uint16_t get_wkc();
00077 
00079   const uint16_t m_wkc;
00081   uint8_t m_idx;
00082 };
00083 inline uint8_t EC_Logic::get_idx()
00084 {
00085   return m_idx++;
00086 }
00087 inline uint16_t EC_Logic::get_wkc()
00088 {
00089   return m_wkc;
00090 }
00091 
00093 
00094 class EtherCAT_AL
00095 {
00096   friend class EtherCAT_Router;
00097 
00098 public:
00099   EtherCAT_AL(EtherCAT_DataLinkLayer *m_dll_instance, EC_Logic *m_logic_instance, EtherCAT_PD_Buffer *_pd_buffer_);
00100   ~EtherCAT_AL();
00101 
00103 
00108   EtherCAT_SlaveHandler * get_slave_handler(EC_FixedStationAddress station_address);
00109 
00111 
00113   unsigned int get_num_slaves()
00114   {
00115     return m_num_slaves;
00116   }
00117 
00119 
00121   EtherCAT_SlaveHandler ** get_slaves()
00122   {
00123     return m_slave_handler;
00124   }
00125 
00127 
00130   bool isReady();
00131 
00133   EtherCAT_DataLinkLayer * m_dll_instance;
00134 
00135 protected:
00137 
00141   bool init(void);
00142 
00144 
00148   bool scan_slaves(void);
00149 
00151 
00153   bool reset_slaves(void);
00154 
00156 
00158   bool put_slaves_in_init(void);
00159 
00160 private:
00162   EC_Logic * m_logic_instance;
00163 
00165   EtherCAT_SlaveHandler ** m_slave_handler;
00166 
00167   EtherCAT_PD_Buffer *pd_buffer_;
00168 
00170 
00176   bool read_SII(uint16_t slave_adp, uint32_t address, unsigned char * a_buffer);
00177 
00179   unsigned int m_num_slaves;
00180 
00182   bool m_ready;
00183 };
00184 
00185 #endif


ros_ethercat_eml
Author(s): Tom Panis, Klaas Gadeyne, Bob Koninckx, Austin Hendrix, Manos Nikolaidis
autogenerated on Thu Jul 4 2019 20:01:49