11 #ifndef _EC_MASTER_H_ |
11 #ifndef _EC_MASTER_H_ |
12 #define _EC_MASTER_H_ |
12 #define _EC_MASTER_H_ |
13 |
13 |
14 #include <linux/list.h> |
14 #include <linux/list.h> |
15 #include <linux/sysfs.h> |
15 #include <linux/sysfs.h> |
|
16 #include <linux/timer.h> |
16 |
17 |
17 #include "device.h" |
18 #include "device.h" |
18 #include "domain.h" |
19 #include "domain.h" |
|
20 |
|
21 /*****************************************************************************/ |
|
22 |
|
23 /** |
|
24 EtherCAT master mode. |
|
25 */ |
|
26 |
|
27 typedef enum |
|
28 { |
|
29 EC_MASTER_MODE_IDLE, |
|
30 EC_MASTER_MODE_FREERUN, |
|
31 EC_MASTER_MODE_RUNNING |
|
32 } |
|
33 ec_master_mode_t; |
19 |
34 |
20 /*****************************************************************************/ |
35 /*****************************************************************************/ |
21 |
36 |
22 /** |
37 /** |
23 EtherCAT-Rahmen-Statistiken. |
38 EtherCAT-Rahmen-Statistiken. |
61 int debug_level; /**< Debug-Level im Master-Code */ |
76 int debug_level; /**< Debug-Level im Master-Code */ |
62 ec_stats_t stats; /**< Rahmen-Statistiken */ |
77 ec_stats_t stats; /**< Rahmen-Statistiken */ |
63 unsigned int timeout; /**< Timeout für synchronen Datenaustausch */ |
78 unsigned int timeout; /**< Timeout für synchronen Datenaustausch */ |
64 struct list_head eoe_slaves; /**< Ethernet over EtherCAT Slaves */ |
79 struct list_head eoe_slaves; /**< Ethernet over EtherCAT Slaves */ |
65 unsigned int reserved; /**< Master durch Echtzeitprozess reserviert */ |
80 unsigned int reserved; /**< Master durch Echtzeitprozess reserviert */ |
|
81 struct timer_list freerun_timer; /**< Timer fuer Free-Run-Modus. */ |
|
82 ec_master_mode_t mode; /**< Modus des Masters */ |
66 }; |
83 }; |
67 |
84 |
68 /*****************************************************************************/ |
85 /*****************************************************************************/ |
69 |
86 |
70 // Master creation and deletion |
87 // Master creation and deletion |
71 int ec_master_init(ec_master_t *, unsigned int); |
88 int ec_master_init(ec_master_t *, unsigned int); |
72 void ec_master_clear(struct kobject *); |
89 void ec_master_clear(struct kobject *); |
73 void ec_master_reset(ec_master_t *); |
90 void ec_master_reset(ec_master_t *); |
|
91 |
|
92 // Free-Run |
|
93 void ec_master_freerun_start(ec_master_t *); |
|
94 void ec_master_freerun_stop(ec_master_t *); |
74 |
95 |
75 // IO |
96 // IO |
76 void ec_master_receive(ec_master_t *, const uint8_t *, size_t); |
97 void ec_master_receive(ec_master_t *, const uint8_t *, size_t); |
77 void ec_master_queue_command(ec_master_t *, ec_command_t *); |
98 void ec_master_queue_command(ec_master_t *, ec_command_t *); |
78 int ec_master_simple_io(ec_master_t *, ec_command_t *); |
99 int ec_master_simple_io(ec_master_t *, ec_command_t *); |