Example code for Simple Open EtherCAT master. More...
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <unistd.h>
#include <sched.h>
#include <string.h>
#include <time.h>
#include <pthread.h>
#include <math.h>
#include "ethercattype.h"
#include "nicdrv.h"
#include "ethercatbase.h"
#include "ethercatmain.h"
#include "ethercatcoe.h"
#include "ethercatconfig.h"
#include "ethercatdc.h"
#include "ethercatprint.h"
Go to the source code of this file.
Macros | |
#define | EC_TIMEOUTMON 500 |
#define | NSEC_PER_SEC 1000000000 |
Functions | |
void | add_timespec (struct timespec *ts, int64 addtime) |
void | ec_sync (int64 reftime, int64 cycletime, int64 *offsettime) |
void | ecatcheck (void *ptr) |
void | ecatthread (void *ptr) |
int | main (int argc, char *argv[]) |
void | redtest (char *ifname, char *ifname2) |
Variables | |
pthread_cond_t | cond = PTHREAD_COND_INITIALIZER |
uint8 | currentgroup = 0 |
int | DCdiff |
int | deltat |
uint8 * | digout = 0 |
int | dorun = 0 |
int | expectedWKC |
int64 | gl_delta |
boolean | inOP |
char | IOmap [4096] |
pthread_mutex_t | mutex = PTHREAD_MUTEX_INITIALIZER |
boolean | needlf |
uint8 | ob |
uint16 | ob2 |
int | os |
struct sched_param | schedp |
struct timeval tv t1 | t2 |
pthread_t | thread1 |
pthread_t | thread2 |
int | tmax = 0 |
int64 | toff |
volatile int | wkc |
Example code for Simple Open EtherCAT master.
Usage : red_test [ifname1] [ifname2] [cycletime] ifname is NIC interface, f.e. eth0 cycletime in us, f.e. 500
This is a redundancy test.
(c)Arthur Ketels 2008
Definition in file linux/red_test/red_test.c.
#define EC_TIMEOUTMON 500 |
Definition at line 34 of file linux/red_test/red_test.c.
#define NSEC_PER_SEC 1000000000 |
Definition at line 33 of file linux/red_test/red_test.c.
void add_timespec | ( | struct timespec * | ts, |
int64 | addtime | ||
) |
Definition at line 167 of file linux/red_test/red_test.c.
Definition at line 184 of file linux/red_test/red_test.c.
void ecatcheck | ( | void * | ptr | ) |
Definition at line 238 of file linux/red_test/red_test.c.
void ecatthread | ( | void * | ptr | ) |
Definition at line 198 of file linux/red_test/red_test.c.
int main | ( | int | argc, |
char * | argv[] | ||
) |
Definition at line 314 of file linux/red_test/red_test.c.
void redtest | ( | char * | ifname, |
char * | ifname2 | ||
) |
Definition at line 57 of file linux/red_test/red_test.c.
pthread_cond_t cond = PTHREAD_COND_INITIALIZER |
Definition at line 47 of file linux/red_test/red_test.c.
uint8 currentgroup = 0 |
Definition at line 54 of file linux/red_test/red_test.c.
int DCdiff |
Definition at line 43 of file linux/red_test/red_test.c.
int deltat |
Definition at line 41 of file linux/red_test/red_test.c.
uint8* digout = 0 |
Definition at line 49 of file linux/red_test/red_test.c.
int dorun = 0 |
Definition at line 40 of file linux/red_test/red_test.c.
int expectedWKC |
Definition at line 50 of file linux/red_test/red_test.c.
int64 gl_delta |
Definition at line 42 of file linux/red_test/red_test.c.
boolean inOP |
Definition at line 53 of file linux/red_test/red_test.c.
char IOmap[4096] |
Definition at line 37 of file linux/red_test/red_test.c.
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER |
Definition at line 48 of file linux/red_test/red_test.c.
boolean needlf |
Definition at line 51 of file linux/red_test/red_test.c.
uint8 ob |
Definition at line 45 of file linux/red_test/red_test.c.
uint16 ob2 |
Definition at line 46 of file linux/red_test/red_test.c.
int os |
Definition at line 44 of file linux/red_test/red_test.c.
struct sched_param schedp |
Definition at line 36 of file linux/red_test/red_test.c.
struct timeval tv t1 t2 |
Definition at line 39 of file linux/red_test/red_test.c.
pthread_t thread1 |
Definition at line 38 of file linux/red_test/red_test.c.
pthread_t thread2 |
Definition at line 38 of file linux/red_test/red_test.c.
int tmax = 0 |
Definition at line 41 of file linux/red_test/red_test.c.
int64 toff |
Definition at line 42 of file linux/red_test/red_test.c.
volatile int wkc |
Definition at line 52 of file linux/red_test/red_test.c.