Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: EasyCAT_LAB_simple EasyCAT_LAB_very_simple EasyCAT_LAB
nicdrv.h
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 nicdrv.c 00009 */ 00010 00011 #ifndef _nicdrvh_ 00012 #define _nicdrvh_ 00013 00014 /** pointer structure to Tx and Rx stacks */ 00015 typedef struct 00016 { 00017 /** socket connection used */ 00018 int *sock; 00019 /** tx buffer */ 00020 ec_bufT (*txbuf)[EC_MAXBUF]; 00021 /** tx buffer lengths */ 00022 int (*txbuflength)[EC_MAXBUF]; 00023 /** temporary receive buffer */ 00024 ec_bufT *tempbuf; 00025 /** rx buffers */ 00026 ec_bufT (*rxbuf)[EC_MAXBUF]; 00027 /** rx buffer status fields */ 00028 int (*rxbufstat)[EC_MAXBUF]; 00029 /** received MAC source address (middle word) */ 00030 int (*rxsa)[EC_MAXBUF]; 00031 } ec_stackT; 00032 00033 /** pointer structure to buffers for redundant port */ 00034 typedef struct 00035 { 00036 ec_stackT stack; 00037 int sockhandle; 00038 /** rx buffers */ 00039 ec_bufT rxbuf[EC_MAXBUF]; 00040 /** rx buffer status */ 00041 int rxbufstat[EC_MAXBUF]; 00042 /** rx MAC source address */ 00043 int rxsa[EC_MAXBUF]; 00044 /** temporary rx buffer */ 00045 ec_bufT tempinbuf; 00046 } ecx_redportt; 00047 00048 /** pointer structure to buffers, vars and mutexes for port instantiation */ 00049 typedef struct 00050 { 00051 ec_stackT stack; 00052 int sockhandle; 00053 /** rx buffers */ 00054 ec_bufT rxbuf[EC_MAXBUF]; 00055 /** rx buffer status */ 00056 int rxbufstat[EC_MAXBUF]; 00057 /** rx MAC source address */ 00058 int rxsa[EC_MAXBUF]; 00059 /** temporary rx buffer */ 00060 ec_bufT tempinbuf; 00061 /** temporary rx buffer status */ 00062 int tempinbufs; 00063 /** transmit buffers */ 00064 ec_bufT txbuf[EC_MAXBUF]; 00065 /** transmit buffer lengths */ 00066 int txbuflength[EC_MAXBUF]; 00067 /** temporary tx buffer */ 00068 ec_bufT txbuf2; 00069 /** temporary tx buffer length */ 00070 int txbuflength2; 00071 /** last used frame index */ 00072 int lastidx; 00073 /** current redundancy state */ 00074 int redstate; 00075 /** pointer to redundancy port and buffers */ 00076 ecx_redportt *redport; 00077 //mtx_t * getindex_mutex; //******// 00078 //mtx_t * tx_mutex; //******// 00079 //mtx_t * rx_mutex; //******// 00080 } ecx_portt; 00081 00082 extern const uint16 priMAC[3]; 00083 extern const uint16 secMAC[3]; 00084 00085 #ifdef EC_VER1 00086 extern ecx_portt ecx_port; 00087 extern ecx_redportt ecx_redport; 00088 00089 int ec_setupnic(const char * ifname, int secondary); 00090 int ec_closenic(void); 00091 void ec_setbufstat(int idx, int bufstat); 00092 int ec_getindex(void); 00093 int ec_outframe(int idx, int stacknumber); 00094 int ec_outframe_red(int idx); 00095 int ec_waitinframe(int idx, int timeout); 00096 int ec_srconfirm(int idx,int timeout); 00097 #endif 00098 00099 void ec_setupheader(void *p); 00100 00101 int ecx_setupnic(ecx_portt *port, const char * ifname, int secondary); 00102 int ecx_closenic(ecx_portt *port); 00103 void ecx_setbufstat(ecx_portt *port, int idx, int bufstat); 00104 int ecx_getindex(ecx_portt *port); 00105 int ecx_outframe(ecx_portt *port, int idx, int stacknumber); 00106 int ecx_outframe_red(ecx_portt *port, int idx); 00107 int ecx_waitinframe(ecx_portt *port, int idx, int timeout); 00108 int ecx_srconfirm(ecx_portt *port, int idx,int timeout); 00109 00110 #endif
Generated on Tue Jul 12 2022 18:21:13 by
