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

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

#include <kern.h>
#include "ethercat.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 428 of file main.c.

#define EK1100_1   1

Definition at line 22 of file main.c.

#define EL1008_1   4

Definition at line 25 of file main.c.

#define EL1008_2   5

Definition at line 26 of file main.c.

#define EL2622_1   6

Definition at line 27 of file main.c.

#define EL2622_2   7

Definition at line 28 of file main.c.

#define EL2622_3   8

Definition at line 29 of file main.c.

#define EL2622_4   9

Definition at line 30 of file main.c.

#define EL3061_1   3

Definition at line 24 of file main.c.

#define EL4001_1   2

Definition at line 23 of file main.c.

#define NUMBER_OF_SLAVES   9

Definition at line 31 of file main.c.

#define pPORTFIO_CLEAR   ((vuint16_t *)PORTFIO_CLEAR)

Definition at line 19 of file main.c.

#define pPORTFIO_DIR   ((vuint16_t *)PORTFIO_DIR)

Definition at line 20 of file main.c.

#define pPORTFIO_SET   ((vuint16_t *)PORTFIO_SET)

Definition at line 18 of file main.c.

#define USECS_PER_SEC   1000000

Definition at line 425 of file main.c.

#define USECS_PER_TICK   (USECS_PER_SEC / CFG_TICKS_PER_SECOND)

Definition at line 426 of file main.c.

Function Documentation

uint8 get_input_bit ( uint16  slave_no,
uint8  module_index 
)

Definition at line 134 of file main.c.

int32 get_input_int32 ( uint16  slave_no,
uint8  module_index 
)

Definition at line 99 of file main.c.

uint8 get_output_bit ( uint16  slave_no,
uint8  module_index 
)

Definition at line 177 of file main.c.

int16 get_output_int16 ( uint16  slave_no,
uint8  module_index 
)

Definition at line 145 of file main.c.

int main ( void  )

Definition at line 505 of file main.c.

static void my_cyclic_callback ( void *  arg)
static

Definition at line 214 of file main.c.

uint32 network_configuration ( void  )

Definition at line 70 of file main.c.

void read_io ( void *  arg)

Definition at line 226 of file main.c.

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

Definition at line 118 of file main.c.

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

Definition at line 188 of file main.c.

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

Definition at line 163 of file main.c.

void simpletest ( void *  arg)

Definition at line 243 of file main.c.

static void test_osal_current_time ( void  )
static

Definition at line 471 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 452 of file main.c.

static void test_osal_timer ( void  )
static

Definition at line 417 of file main.c.

static void test_osal_timer_timeout_us ( const uint32  timeout_us)
static

Definition at line 403 of file main.c.

static void test_oshw_htons ( void  )
static

Definition at line 485 of file main.c.

static void test_oshw_ntohs ( void  )
static

Definition at line 495 of file main.c.

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

Definition at line 431 of file main.c.

void tt_error ( uint32_t  task_ix)

Definition at line 209 of file main.c.

Variable Documentation

int dorun = 0

Definition at line 203 of file main.c.

uint32_t error_counter = 0

Definition at line 206 of file main.c.

char IOmap[128]

Definition at line 202 of file main.c.

uint8_t load10s

Definition at line 205 of file main.c.

uint8_t load1s

Definition at line 205 of file main.c.

uint8_t load5s

Definition at line 205 of file main.c.

in_EL1008_t slave_EL1008_1

Definition at line 64 of file main.c.

in_EL1008_t slave_EL1008_2

Definition at line 65 of file main.c.

out_EL2622_t slave_EL2622_1

Definition at line 66 of file main.c.

out_EL2622_t slave_EL2622_2

Definition at line 67 of file main.c.

out_EL2622_t slave_EL2622_3

Definition at line 68 of file main.c.

in_EL3061_t slave_EL3061_1

Definition at line 63 of file main.c.

out_EL4001_t slave_EL4001_1

Definition at line 62 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 27 2020 03:48:21