Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #ifndef __posix_netif_h__
00035 #define __posix_netif_h__
00036
00037
00038 struct EtherCAT_Frame;
00039 struct netif;
00040
00041 #include <stdint.h>
00042 #include <stdlib.h>
00043
00044 #define ETHERCAT_DEVICE_NAME_MAX_LENGTH 256
00045
00046 #define MAC_ADDRESS_SIZE 6
00047
00048 void if_attach(struct netif * netif);
00049 int framedump(const struct EtherCAT_Frame * frame, unsigned char * buffer, size_t bufferlength);
00050 int framebuild(struct EtherCAT_Frame * frame, const unsigned char * buffer);
00051
00052
00053 #define PKT_LIST_SIZE 128
00054
00055
00056 #define BUF_LIST_SIZE 16
00057
00058
00059 #define MAX_UNCLAIMED_PACKETS (BUF_LIST_SIZE-1)
00060
00061
00062
00063 struct pkt_buf
00064 {
00065
00066 bool is_free;
00067
00068
00069 unsigned char data[2000];
00070 };
00071
00072
00073
00074
00075
00076
00077 struct outstanding_pkt
00078 {
00079
00080 bool is_free;
00081
00082
00083
00084 struct pkt_buf *buf;
00085
00086
00087
00088 uint8_t ether_shost[MAC_ADDRESS_SIZE];
00089
00090
00091
00092 struct EtherCAT_Frame * frame;
00093
00094
00095
00096
00097 pthread_cond_t rx_cond;
00098
00099
00100 struct timespec tx_time;
00101 };
00102
00103 struct netif_counters
00104 {
00105 uint64_t sent;
00106 uint64_t received;
00107 uint64_t collected;
00108 uint64_t dropped;
00109 uint64_t tx_error;
00110 uint64_t tx_net_down;
00111 uint64_t tx_would_block;
00112 uint64_t tx_no_bufs;
00113 uint64_t tx_full;
00114 uint64_t rx_runt_pkt;
00115 uint64_t rx_not_ecat;
00116 uint64_t rx_other_eml;
00117 uint64_t rx_bad_index;
00118 uint64_t rx_bad_seqnum;
00119 uint64_t rx_dup_seqnum;
00120 uint64_t rx_dup_pkt;
00121 uint64_t rx_bad_order;
00122 uint64_t rx_late_pkt;
00123 uint64_t sw_dropped;
00124 uint64_t rx_late_pkt_rtt_us;
00125 uint64_t rx_late_pkt_rtt_us_sum;
00126 };
00127
00129
00134 struct netif
00135 {
00137
00141 bool (*txandrx)(struct EtherCAT_Frame * frame, struct netif * netif);
00142
00145 bool (*txandrx_once)(struct EtherCAT_Frame * frame, struct netif * netif);
00146
00148
00151 int (*tx)(struct EtherCAT_Frame * frame, struct netif * netif);
00152
00154
00156 bool (*rx)(struct EtherCAT_Frame * frame, struct netif * netif, int handle);
00157
00159
00161 bool (*drop)(struct EtherCAT_Frame * frame, struct netif * netif, int handle);
00162
00164
00166 bool (*rx_nowait)(struct EtherCAT_Frame * frame, struct netif * netif, int handle);
00167
00169 unsigned char hwaddr[MAC_ADDRESS_SIZE];
00171 int socket_private;
00172
00174 struct netif_counters counters;
00175
00177 unsigned tx_seqnum;
00178
00180 unsigned rx_seqnum;
00181
00183 unsigned next_pkt_index;
00184
00187 struct outstanding_pkt pkt_list[PKT_LIST_SIZE];
00188
00189
00190 unsigned unclaimed_packets;
00191
00193 struct pkt_buf buf_list[BUF_LIST_SIZE];
00194
00195
00196 pthread_mutex_t txandrx_mut;
00197 pthread_mutexattr_t txandrx_attr;
00198
00199
00200 pthread_t input_thread;
00201 volatile bool stop;
00202 volatile bool is_stopped;
00203
00204
00205 int timeout_us;
00206
00207
00208 void* private_data;
00209 };
00210
00211 #endif // __netif_h__
ros_ethercat_eml
Author(s): Tom Panis, Klaas Gadeyne, Bob Koninckx, Austin Hendrix, Manos Nikolaidis
autogenerated on Thu Jul 4 2019 20:01:49