SOEM  v1.4.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 "ethercat.h"

Macros

#define NSEC_PER_SEC   1000000000
 
#define EC_TIMEOUTMON   500
 
#define stack64k   (64 * 1024)
 

Functions

void redtest (char *ifname, char *ifname2)
 
void add_timespec (struct timespec *ts, int64 addtime)
 
void ec_sync (int64 reftime, int64 cycletime, int64 *offsettime)
 
OSAL_THREAD_FUNC_RT ecatthread (void *ptr)
 
OSAL_THREAD_FUNC 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
 
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

◆ EC_TIMEOUTMON

#define EC_TIMEOUTMON   500

◆ NSEC_PER_SEC

#define NSEC_PER_SEC   1000000000

◆ stack64k

#define stack64k   (64 * 1024)

Function Documentation

◆ add_timespec()

void add_timespec ( struct timespec *  ts,
int64  addtime 
)

◆ ec_sync()

void ec_sync ( int64  reftime,
int64  cycletime,
int64 *  offsettime 
)

◆ ecatcheck()

OSAL_THREAD_FUNC ecatcheck ( void *  ptr)

◆ ecatthread()

OSAL_THREAD_FUNC_RT ecatthread ( void *  ptr)

◆ main()

int main ( int  argc,
char *  argv[] 
)

◆ redtest()

void redtest ( char *  ifname,
char *  ifname2 
)

Variable Documentation

◆ currentgroup

uint8 currentgroup = 0

◆ DCdiff

int DCdiff

◆ deltat

int deltat

◆ digout

uint8* digout = 0

◆ dorun

int dorun = 0

◆ expectedWKC

int expectedWKC

◆ gl_delta

int64 gl_delta

◆ inOP

boolean inOP

◆ IOmap

char IOmap[4096]

◆ needlf

boolean needlf

◆ ob

uint8 ob

◆ ob2

uint16 ob2

◆ os

int os

◆ schedp

struct sched_param schedp

◆ t2

struct timeval tv t1 t2

◆ thread1

pthread_t thread1

◆ thread2

pthread_t thread2

◆ tmax

int tmax = 0

◆ toff

int64 toff

◆ wkc

volatile int wkc