nicdrv.h
Go to the documentation of this file.
00001 /*
00002  * Simple Open EtherCAT Master Library 
00003  *
00004  * File    : nicdrv.h
00005  * Version : 1.3.0
00006  * Date    : 24-02-2013
00007  * Copyright (C) 2005-2013 Speciaal Machinefabriek Ketels v.o.f.
00008  * Copyright (C) 2005-2013 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 
00046 #ifndef _nicdrvh_
00047 #define _nicdrvh_
00048 
00049 #ifdef __cplusplus
00050 extern "C"
00051 {
00052 #endif
00053 
00054 #include <pthread.h>
00055 
00057 typedef struct
00058 {
00060    int         *sock;
00062    ec_bufT     (*txbuf)[EC_MAXBUF];
00064    int         (*txbuflength)[EC_MAXBUF];
00066    ec_bufT     *tempbuf;
00068    ec_bufT     (*rxbuf)[EC_MAXBUF];
00070    int         (*rxbufstat)[EC_MAXBUF];
00072    int         (*rxsa)[EC_MAXBUF];
00073 } ec_stackT;   
00074 
00076 typedef struct
00077 {
00078    ec_stackT   stack;
00079    int         sockhandle;
00081    ec_bufT rxbuf[EC_MAXBUF];
00083    int rxbufstat[EC_MAXBUF];
00085    int rxsa[EC_MAXBUF];
00087    ec_bufT tempinbuf;
00088 } ecx_redportt;
00089 
00091 typedef struct
00092 {
00093    ec_stackT   stack;
00094    int         sockhandle;
00096    ec_bufT rxbuf[EC_MAXBUF];
00098    int rxbufstat[EC_MAXBUF];
00100    int rxsa[EC_MAXBUF];
00102    ec_bufT tempinbuf;
00104    int tempinbufs;
00106    ec_bufT txbuf[EC_MAXBUF];
00108    int txbuflength[EC_MAXBUF];
00110    ec_bufT txbuf2;
00112    int txbuflength2;
00114    int lastidx;
00116    int redstate;
00118    ecx_redportt *redport;   
00119    pthread_mutex_t getindex_mutex; 
00120    pthread_mutex_t tx_mutex;
00121    pthread_mutex_t rx_mutex;
00122 } ecx_portt;
00123 
00124 extern const uint16 priMAC[3];
00125 extern const uint16 secMAC[3];
00126 
00127 #ifdef EC_VER1
00128 extern ecx_portt     ecx_port;
00129 extern ecx_redportt  ecx_redport;
00130 
00131 int ec_setupnic(const char * ifname, int secondary);
00132 int ec_closenic(void);
00133 void ec_setbufstat(int idx, int bufstat);
00134 int ec_getindex(void);
00135 int ec_outframe(int idx, int sock);
00136 int ec_outframe_red(int idx);
00137 int ec_waitinframe(int idx, int timeout);
00138 int ec_srconfirm(int idx,int timeout);
00139 #endif
00140 
00141 void ec_setupheader(void *p);
00142 int ecx_setupnic(ecx_portt *port, const char * ifname, int secondary);
00143 int ecx_closenic(ecx_portt *port);
00144 void ecx_setbufstat(ecx_portt *port, int idx, int bufstat);
00145 int ecx_getindex(ecx_portt *port);
00146 int ecx_outframe(ecx_portt *port, int idx, int sock);
00147 int ecx_outframe_red(ecx_portt *port, int idx);
00148 int ecx_waitinframe(ecx_portt *port, int idx, int timeout);
00149 int ecx_srconfirm(ecx_portt *port, int idx,int timeout);
00150 
00151 #ifdef __cplusplus
00152 }
00153 #endif
00154 
00155 #endif


ethercat_soem
Author(s): Arthur Ketels, M.J.G. van de Molengraft
autogenerated on Wed Aug 26 2015 11:32:40