SOEM  v1.4.0
Data Structures | Macros | Functions | Variables
ebox.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"

Data Structures

struct  in_EBOXt
 
struct  in_EBOX_streamt
 
struct  out_EBOXt
 
struct  out_EBOX_streamt
 

Macros

#define NSEC_PER_SEC   1000000000
 
#define MAXSTREAM   200000
 
#define SYNC0TIME   8000
 

Functions

int output_cvs (char *fname, int length)
 
void eboxtest (char *ifname)
 
void add_timespec (struct timespec *ts, int64 addtime)
 
void ec_sync (int64 reftime, int64 cycletime, int64 *offsettime)
 
void ecatthread (void *ptr)
 
int main (int argc, char *argv[])
 

Variables

struct sched_param schedp
 
char IOmap [4096]
 
pthread_t thread1
 
struct timeval tv t1 t2
 
int dorun = 0
 
int deltat
 
int tmax =0
 
int64 toff
 
int DCdiff
 
int os
 
uint32 ob
 
int16 ob2
 
uint8 ob3
 
pthread_cond_t cond = PTHREAD_COND_INITIALIZER
 
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER
 
int64 integral =0
 
uint32 cyclecount
 
in_EBOX_streamtin_EBOX
 
out_EBOX_streamtout_EBOX
 
double ain [2]
 
int ainc
 
int streampos
 
int16 stream1 [MAXSTREAM]
 
int16 stream2 [MAXSTREAM]
 

Detailed Description

Example code for Simple Open EtherCAT master.

Usage : ebox [ifname] [cycletime] ifname is NIC interface, f.e. eth0 cycletime in us, f.e. 500

This test is specifically build for the E/BOX.

(c)Arthur Ketels 2011

Macro Definition Documentation

◆ MAXSTREAM

#define MAXSTREAM   200000

◆ NSEC_PER_SEC

#define NSEC_PER_SEC   1000000000

◆ SYNC0TIME

#define SYNC0TIME   8000

Function Documentation

◆ add_timespec()

void add_timespec ( struct timespec *  ts,
int64  addtime 
)

◆ eboxtest()

void eboxtest ( char *  ifname)

◆ ec_sync()

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

◆ ecatthread()

void ecatthread ( void *  ptr)

◆ main()

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

◆ output_cvs()

int output_cvs ( char *  fname,
int  length 
)

Variable Documentation

◆ ain

double ain[2]

◆ ainc

int ainc

◆ cond

pthread_cond_t cond = PTHREAD_COND_INITIALIZER

◆ cyclecount

uint32 cyclecount

◆ DCdiff

int DCdiff

◆ deltat

int deltat

◆ dorun

int dorun = 0

◆ in_EBOX

in_EBOX_streamt* in_EBOX

◆ integral

int64 integral =0

◆ IOmap

char IOmap[4096]

◆ mutex

pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER

◆ ob

uint32 ob

◆ ob2

int16 ob2

◆ ob3

uint8 ob3

◆ os

int os

◆ out_EBOX

out_EBOX_streamt* out_EBOX

◆ schedp

struct sched_param schedp

◆ stream1

int16 stream1[MAXSTREAM]

◆ stream2

int16 stream2[MAXSTREAM]

◆ streampos

int streampos

◆ t2

struct timeval tv t1 t2

◆ thread1

pthread_t thread1

◆ tmax

int tmax =0

◆ toff

int64 toff