SOEM  v1.3.0
Macros | Functions | Variables
red_test.c File Reference

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"

Macros

#define NSEC_PER_SEC   1000000000
 
#define EC_TIMEOUTMON   500
 

Functions

void redtest (char *ifname, char *ifname2)
 
void add_timespec (struct timespec *ts, int64 addtime)
 
void ec_sync (int64 reftime, int64 cycletime, int64 *offsettime)
 
void ecatthread (void *ptr)
 
void ecatcheck (void *ptr)
 
int main (int argc, char *argv[])
 

Variables

struct sched_param schedp
 
char IOmap [4096]
 
pthread_t thread1
 
pthread_t thread2
 
struct timeval tv t1 t2
 
int dorun = 0
 
int deltat
 
int tmax = 0
 
int64 toff
 
int64 gl_delta
 
int DCdiff
 
int os
 
uint8 ob
 
uint16 ob2
 
pthread_cond_t cond = PTHREAD_COND_INITIALIZER
 
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER
 
uint8 * digout = 0
 
int expectedWKC
 
boolean needlf
 
volatile int wkc
 
boolean inOP
 
uint8 currentgroup = 0
 

Detailed Description

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

Macro Definition Documentation

#define EC_TIMEOUTMON   500
#define NSEC_PER_SEC   1000000000

Function Documentation

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 
)

Variable Documentation

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