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 "ethercattype.h"
Include dependency graph for ebox.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  PACKED
 SDO structure, not to be confused with EcSDOserviceT. More...
struct  PACKED
 SDO structure, not to be confused with EcSDOserviceT. More...
struct  PACKED
 SDO structure, not to be confused with EcSDOserviceT. More...
struct  PACKED
 SDO structure, not to be confused with EcSDOserviceT. More...

Defines

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

Typedefs

typedef struct PACKED in_EBOXt
typedef struct PACKED in_EBOX_streamt
typedef struct PACKED out_EBOXt
typedef struct PACKED out_EBOX_streamt

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

Definition in file ebox.c.


Define Documentation

#define MAXSTREAM   200000

Definition at line 64 of file ebox.c.

#define NSEC_PER_SEC   1000000000

Definition at line 32 of file ebox.c.

#define SYNC0TIME   8000

Definition at line 67 of file ebox.c.


Typedef Documentation

typedef struct PACKED in_EBOX_streamt
typedef struct PACKED in_EBOXt
typedef struct PACKED out_EBOX_streamt
typedef struct PACKED out_EBOXt

Function Documentation

void add_timespec ( struct timespec *  ts,
int64  addtime 
)

Definition at line 250 of file ebox.c.

Here is the caller graph for this function:

void eboxtest ( char *  ifname  ) 

Definition at line 110 of file ebox.c.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 267 of file ebox.c.

Here is the caller graph for this function:

void ecatthread ( void *  ptr  ) 

Definition at line 279 of file ebox.c.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 341 of file ebox.c.

Here is the call graph for this function:

int output_cvs ( char *  fname,
int  length 
)

Definition at line 93 of file ebox.c.

Here is the caller graph for this function:


Variable Documentation

double ain[2]

Definition at line 87 of file ebox.c.

int ainc

Definition at line 88 of file ebox.c.

pthread_cond_t cond = PTHREAD_COND_INITIALIZER

Definition at line 81 of file ebox.c.

Definition at line 84 of file ebox.c.

int DCdiff

Definition at line 76 of file ebox.c.

int deltat

Definition at line 74 of file ebox.c.

int dorun = 0

Definition at line 73 of file ebox.c.

Definition at line 85 of file ebox.c.

Definition at line 83 of file ebox.c.

char IOmap[4096]

Definition at line 70 of file ebox.c.

pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER

Definition at line 82 of file ebox.c.

Definition at line 78 of file ebox.c.

Definition at line 79 of file ebox.c.

Definition at line 80 of file ebox.c.

int os

Definition at line 77 of file ebox.c.

Definition at line 86 of file ebox.c.

struct sched_param schedp

Definition at line 69 of file ebox.c.

int16 stream1[MAXSTREAM]

Definition at line 90 of file ebox.c.

int16 stream2[MAXSTREAM]

Definition at line 91 of file ebox.c.

int streampos

Definition at line 89 of file ebox.c.

struct timeval tv t1 t2

Definition at line 72 of file ebox.c.

pthread_t thread1

Definition at line 71 of file ebox.c.

int tmax = 0

Definition at line 74 of file ebox.c.

Definition at line 75 of file ebox.c.

Generated by  doxygen 1.6.3