69 Cyclic statistics. |
69 Cyclic statistics. |
70 */ |
70 */ |
71 |
71 |
72 typedef struct |
72 typedef struct |
73 { |
73 { |
74 unsigned int timeouts; /**< command timeouts */ |
74 unsigned int timeouts; /**< datagram timeouts */ |
75 unsigned int delayed; /**< delayed commands */ |
75 unsigned int delayed; /**< delayed datagrams */ |
76 unsigned int corrupted; /**< corrupted frames */ |
76 unsigned int corrupted; /**< corrupted frames */ |
77 unsigned int unmatched; /**< unmatched commands */ |
77 unsigned int unmatched; /**< unmatched datagrams */ |
78 cycles_t t_last; /**< time of last output */ |
78 cycles_t t_last; /**< time of last output */ |
79 } |
79 } |
80 ec_stats_t; |
80 ec_stats_t; |
81 |
81 |
82 /*****************************************************************************/ |
82 /*****************************************************************************/ |
97 struct list_head slaves; /**< list of slaves on the bus */ |
97 struct list_head slaves; /**< list of slaves on the bus */ |
98 unsigned int slave_count; /**< number of slaves on the bus */ |
98 unsigned int slave_count; /**< number of slaves on the bus */ |
99 |
99 |
100 ec_device_t *device; /**< EtherCAT device */ |
100 ec_device_t *device; /**< EtherCAT device */ |
101 |
101 |
102 struct list_head command_queue; /**< command queue */ |
102 struct list_head datagram_queue; /**< datagram queue */ |
103 uint8_t command_index; /**< current command index */ |
103 uint8_t datagram_index; /**< current datagram index */ |
104 |
104 |
105 struct list_head domains; /**< list of domains */ |
105 struct list_head domains; /**< list of domains */ |
106 |
106 |
107 ec_command_t simple_command; /**< command structure for initialization */ |
107 ec_datagram_t simple_datagram; /**< datagram structure for |
|
108 initialization */ |
108 unsigned int timeout; /**< timeout in synchronous IO */ |
109 unsigned int timeout; /**< timeout in synchronous IO */ |
109 |
110 |
110 int debug_level; /**< master debug level */ |
111 int debug_level; /**< master debug level */ |
111 ec_stats_t stats; /**< cyclic statistics */ |
112 ec_stats_t stats; /**< cyclic statistics */ |
112 |
113 |
113 struct workqueue_struct *workqueue; /**< master workqueue */ |
114 struct workqueue_struct *workqueue; /**< master workqueue */ |
114 struct work_struct freerun_work; /**< free run work object */ |
115 struct work_struct idle_work; /**< free run work object */ |
115 ec_fsm_t fsm; /**< master state machine */ |
116 ec_fsm_t fsm; /**< master state machine */ |
116 ec_master_mode_t mode; /**< master mode */ |
117 ec_master_mode_t mode; /**< master mode */ |
117 |
118 |
118 struct timer_list eoe_timer; /**< EoE timer object */ |
119 struct timer_list eoe_timer; /**< EoE timer object */ |
119 unsigned int eoe_running; /**< non-zero, if EoE processing is active. */ |
120 unsigned int eoe_running; /**< non-zero, if EoE processing is active. */ |
120 struct list_head eoe_handlers; /**< Ethernet-over-EtherCAT handlers */ |
121 struct list_head eoe_handlers; /**< Ethernet-over-EtherCAT handlers */ |
121 spinlock_t internal_lock; /**< spinlock used in freerun mode */ |
122 spinlock_t internal_lock; /**< spinlock used in idle mode */ |
122 int (*request_cb)(void *); /**< lock request callback */ |
123 int (*request_cb)(void *); /**< lock request callback */ |
123 void (*release_cb)(void *); /**< lock release callback */ |
124 void (*release_cb)(void *); /**< lock release callback */ |
124 void *cb_data; /**< data parameter of locking callbacks */ |
125 void *cb_data; /**< data parameter of locking callbacks */ |
125 |
126 |
126 uint8_t eeprom_write_enable; /**< allow write operations to EEPROMs */ |
127 uint8_t eeprom_write_enable; /**< allow write operations to EEPROMs */ |
132 int ec_master_init(ec_master_t *, unsigned int, unsigned int); |
133 int ec_master_init(ec_master_t *, unsigned int, unsigned int); |
133 void ec_master_clear(struct kobject *); |
134 void ec_master_clear(struct kobject *); |
134 void ec_master_reset(ec_master_t *); |
135 void ec_master_reset(ec_master_t *); |
135 |
136 |
136 // free run |
137 // free run |
137 void ec_master_freerun_start(ec_master_t *); |
138 void ec_master_idle_start(ec_master_t *); |
138 void ec_master_freerun_stop(ec_master_t *); |
139 void ec_master_idle_stop(ec_master_t *); |
139 |
140 |
140 // EoE |
141 // EoE |
141 void ec_master_eoe_start(ec_master_t *); |
142 void ec_master_eoe_start(ec_master_t *); |
142 void ec_master_eoe_stop(ec_master_t *); |
143 void ec_master_eoe_stop(ec_master_t *); |
143 |
144 |
144 // IO |
145 // IO |
145 void ec_master_receive(ec_master_t *, const uint8_t *, size_t); |
146 void ec_master_receive(ec_master_t *, const uint8_t *, size_t); |
146 void ec_master_queue_command(ec_master_t *, ec_command_t *); |
147 void ec_master_queue_datagram(ec_master_t *, ec_datagram_t *); |
147 int ec_master_simple_io(ec_master_t *, ec_command_t *); |
148 int ec_master_simple_io(ec_master_t *, ec_datagram_t *); |
148 |
149 |
149 // slave management |
150 // slave management |
150 int ec_master_bus_scan(ec_master_t *); |
151 int ec_master_bus_scan(ec_master_t *); |
151 |
152 |
152 // misc. |
153 // misc. |
153 void ec_master_clear_slaves(ec_master_t *); |
154 void ec_master_clear_slaves(ec_master_t *); |
154 void ec_sync_config(const ec_sync_t *, const ec_slave_t *, uint8_t *); |
155 void ec_sync_config(const ec_sync_t *, const ec_slave_t *, uint8_t *); |
155 void ec_eeprom_sync_config(const ec_eeprom_sync_t *, uint8_t *); |
156 void ec_eeprom_sync_config(const ec_eeprom_sync_t *, const ec_slave_t *, |
|
157 uint8_t *); |
156 void ec_fmmu_config(const ec_fmmu_t *, const ec_slave_t *, uint8_t *); |
158 void ec_fmmu_config(const ec_fmmu_t *, const ec_slave_t *, uint8_t *); |
157 void ec_master_output_stats(ec_master_t *); |
159 void ec_master_output_stats(ec_master_t *); |
158 |
160 |
159 /*****************************************************************************/ |
161 /*****************************************************************************/ |
160 |
162 |