Classes | Macros | Functions | Variables
main.c File Reference

Example code for Simple Open EtherCAT master. More...

#include <kern.h>
#include "ethercattype.h"
#include "nicdrv.h"
#include "ethercatbase.h"
#include "ethercatmain.h"
#include "ethercatcoe.h"
#include "ethercatfoe.h"
#include "ethercatconfig.h"
#include "ethercatprint.h"
#include "string.h"
#include <oshw.h>
#include <config.h>
#include <defBF537.h>
#include <lwip/inet.h>
Include dependency graph for main.c:

Go to the source code of this file.

Classes

struct  in_EL1008_t
 
struct  in_EL3061_t
 
struct  out_EL2622_t
 
struct  out_EL4001_t
 

Macros

#define ABS(x)   ((x) < 0 ? -(x) : (x))
 
#define EK1100_1   1
 
#define EL1008_1   4
 
#define EL1008_2   5
 
#define EL2622_1   6
 
#define EL2622_2   7
 
#define EL2622_3   8
 
#define EL2622_4   9
 
#define EL3061_1   3
 
#define EL4001_1   2
 
#define NUMBER_OF_SLAVES   9
 
#define pPORTFIO_CLEAR   ((vuint16_t *)PORTFIO_CLEAR)
 
#define pPORTFIO_DIR   ((vuint16_t *)PORTFIO_DIR)
 
#define pPORTFIO_SET   ((vuint16_t *)PORTFIO_SET)
 
#define USECS_PER_SEC   1000000
 
#define USECS_PER_TICK   (USECS_PER_SEC / CFG_TICKS_PER_SECOND)
 

Functions

uint8 get_input_bit (uint16 slave_no, uint8 module_index)
 
int32 get_input_int32 (uint16 slave_no, uint8 module_index)
 
uint8 get_output_bit (uint16 slave_no, uint8 module_index)
 
int16 get_output_int16 (uint16 slave_no, uint8 module_index)
 
int main (void)
 
static void my_cyclic_callback (void *arg)
 
uint32 network_configuration (void)
 
void read_io (void *arg)
 
void set_input_int32 (uint16 slave_no, uint8 module_index, int32 value)
 
void set_output_bit (uint16 slave_no, uint8 module_index, uint8 value)
 
void set_output_int16 (uint16 slave_no, uint8 module_index, int16 value)
 
void simpletest (void *arg)
 
static void test_osal_current_time (void)
 
static void test_osal_current_time_for_delay_us (const int32 sleep_time_us)
 
static void test_osal_timer (void)
 
static void test_osal_timer_timeout_us (const uint32 timeout_us)
 
static void test_oshw_htons (void)
 
static void test_oshw_ntohs (void)
 
static int32 time_difference_us (const ec_timet stop, const ec_timet start)
 
void tt_error (uint32_t task_ix)
 

Variables

int dorun = 0
 
uint32_t error_counter = 0
 
char IOmap [128]
 
uint8_t load10s
 
uint8_t load1s
 
uint8_t load5s
 
in_EL1008_t slave_EL1008_1
 
in_EL1008_t slave_EL1008_2
 
out_EL2622_t slave_EL2622_1
 
out_EL2622_t slave_EL2622_2
 
out_EL2622_t slave_EL2622_3
 
in_EL3061_t slave_EL3061_1
 
out_EL4001_t slave_EL4001_1
 
tt_sched_t * tt_sched []
 

Detailed Description

Example code for Simple Open EtherCAT master.

This is a minimal example running rt-kernel TTOS. Check tutorial files in documentations for som steps to get your system running. (c)Andreas Karlsson 2012

Definition in file main.c.

Macro Definition Documentation

#define ABS (   x)    ((x) < 0 ? -(x) : (x))

Definition at line 435 of file main.c.

#define EK1100_1   1

Definition at line 29 of file main.c.

#define EL1008_1   4

Definition at line 32 of file main.c.

#define EL1008_2   5

Definition at line 33 of file main.c.

#define EL2622_1   6

Definition at line 34 of file main.c.

#define EL2622_2   7

Definition at line 35 of file main.c.

#define EL2622_3   8

Definition at line 36 of file main.c.

#define EL2622_4   9

Definition at line 37 of file main.c.

#define EL3061_1   3

Definition at line 31 of file main.c.

#define EL4001_1   2

Definition at line 30 of file main.c.

#define NUMBER_OF_SLAVES   9

Definition at line 38 of file main.c.

#define pPORTFIO_CLEAR   ((vuint16_t *)PORTFIO_CLEAR)

Definition at line 26 of file main.c.

#define pPORTFIO_DIR   ((vuint16_t *)PORTFIO_DIR)

Definition at line 27 of file main.c.

#define pPORTFIO_SET   ((vuint16_t *)PORTFIO_SET)

Definition at line 25 of file main.c.

#define USECS_PER_SEC   1000000

Definition at line 432 of file main.c.

#define USECS_PER_TICK   (USECS_PER_SEC / CFG_TICKS_PER_SECOND)

Definition at line 433 of file main.c.

Function Documentation

uint8 get_input_bit ( uint16  slave_no,
uint8  module_index 
)

Definition at line 141 of file main.c.

int32 get_input_int32 ( uint16  slave_no,
uint8  module_index 
)

Definition at line 106 of file main.c.

uint8 get_output_bit ( uint16  slave_no,
uint8  module_index 
)

Definition at line 184 of file main.c.

int16 get_output_int16 ( uint16  slave_no,
uint8  module_index 
)

Definition at line 152 of file main.c.

int main ( void  )

Definition at line 512 of file main.c.

static void my_cyclic_callback ( void *  arg)
static

Definition at line 221 of file main.c.

uint32 network_configuration ( void  )

Definition at line 77 of file main.c.

void read_io ( void *  arg)

Definition at line 233 of file main.c.

void set_input_int32 ( uint16  slave_no,
uint8  module_index,
int32  value 
)

Definition at line 125 of file main.c.

void set_output_bit ( uint16  slave_no,
uint8  module_index,
uint8  value 
)

Definition at line 195 of file main.c.

void set_output_int16 ( uint16  slave_no,
uint8  module_index,
int16  value 
)

Definition at line 170 of file main.c.

void simpletest ( void *  arg)

Definition at line 250 of file main.c.

static void test_osal_current_time ( void  )
static

Definition at line 478 of file main.c.

static void test_osal_current_time_for_delay_us ( const int32  sleep_time_us)
static

Test osal_current_time() by using it for measuring how long an osal_usleep() takes, in specified number of microseconds.

Definition at line 459 of file main.c.

static void test_osal_timer ( void  )
static

Definition at line 424 of file main.c.

static void test_osal_timer_timeout_us ( const uint32  timeout_us)
static

Definition at line 410 of file main.c.

static void test_oshw_htons ( void  )
static

Definition at line 492 of file main.c.

static void test_oshw_ntohs ( void  )
static

Definition at line 502 of file main.c.

static int32 time_difference_us ( const ec_timet  stop,
const ec_timet  start 
)
static

Definition at line 438 of file main.c.

void tt_error ( uint32_t  task_ix)

Definition at line 216 of file main.c.

Variable Documentation

int dorun = 0

Definition at line 210 of file main.c.

uint32_t error_counter = 0

Definition at line 213 of file main.c.

char IOmap[128]

Definition at line 209 of file main.c.

uint8_t load10s

Definition at line 212 of file main.c.

uint8_t load1s

Definition at line 212 of file main.c.

uint8_t load5s

Definition at line 212 of file main.c.

in_EL1008_t slave_EL1008_1

Definition at line 71 of file main.c.

in_EL1008_t slave_EL1008_2

Definition at line 72 of file main.c.

out_EL2622_t slave_EL2622_1

Definition at line 73 of file main.c.

out_EL2622_t slave_EL2622_2

Definition at line 74 of file main.c.

out_EL2622_t slave_EL2622_3

Definition at line 75 of file main.c.

in_EL3061_t slave_EL3061_1

Definition at line 70 of file main.c.

out_EL4001_t slave_EL4001_1

Definition at line 69 of file main.c.

tt_sched_t* tt_sched[]


soem
Author(s): Arthur Ketels and M.J.G. van den Molengraft
autogenerated on Sat Jun 8 2019 18:02:17