111 if (master->debug_level >= level) { \ |
111 if (master->debug_level >= level) { \ |
112 printk(KERN_DEBUG "EtherCAT DEBUG %u: " fmt, \ |
112 printk(KERN_DEBUG "EtherCAT DEBUG %u: " fmt, \ |
113 master->index, ##args); \ |
113 master->index, ##args); \ |
114 } \ |
114 } \ |
115 } while (0) |
115 } while (0) |
|
116 |
|
117 |
|
118 /** Size of the external datagram ring. |
|
119 * |
|
120 * The external datagram ring is used for slave FSMs. |
|
121 */ |
|
122 #define EC_EXT_RING_SIZE 32 |
116 |
123 |
117 /*****************************************************************************/ |
124 /*****************************************************************************/ |
118 |
125 |
119 /** EtherCAT master phase. |
126 /** EtherCAT master phase. |
120 */ |
127 */ |
258 struct list_head ext_datagram_queue; /**< Queue for non-application |
265 struct list_head ext_datagram_queue; /**< Queue for non-application |
259 datagrams. */ |
266 datagrams. */ |
260 struct semaphore ext_queue_sem; /**< Semaphore protecting the \a |
267 struct semaphore ext_queue_sem; /**< Semaphore protecting the \a |
261 ext_datagram_queue. */ |
268 ext_datagram_queue. */ |
262 |
269 |
263 struct list_head external_datagram_queue; /**< External Datagram queue. */ |
270 ec_datagram_t ext_datagram_ring[EC_EXT_RING_SIZE]; /**< External datagram |
|
271 ring. */ |
|
272 unsigned int ext_ring_idx_rt; /**< Index in external datagram ring for RT |
|
273 side. */ |
|
274 unsigned int ext_ring_idx_fsm; /**< Index in external datagram ring for |
|
275 FSM side. */ |
264 unsigned int send_interval; /**< Interval between two calls to |
276 unsigned int send_interval; /**< Interval between two calls to |
265 ecrt_master_send(). */ |
277 ecrt_master_send(). */ |
266 size_t max_queue_size; /**< Maximum size of datagram queue */ |
278 size_t max_queue_size; /**< Maximum size of datagram queue */ |
|
279 |
|
280 ec_slave_t *fsm_slave; /**< Slave that is queried next for FSM exec. */ |
|
281 struct list_head fsm_exec_list; /**< Slave FSM execution list. */ |
|
282 unsigned int fsm_exec_count; /**< Number of entries in execution list. */ |
267 |
283 |
268 unsigned int debug_level; /**< Master debug level. */ |
284 unsigned int debug_level; /**< Master debug level. */ |
269 ec_stats_t stats; /**< Cyclic statistics. */ |
285 ec_stats_t stats; /**< Cyclic statistics. */ |
270 |
286 |
271 struct task_struct *thread; /**< Master thread. */ |
287 struct task_struct *thread; /**< Master thread. */ |
322 |
338 |
323 // datagram IO |
339 // datagram IO |
324 void ec_master_receive_datagrams(ec_master_t *, const uint8_t *, size_t); |
340 void ec_master_receive_datagrams(ec_master_t *, const uint8_t *, size_t); |
325 void ec_master_queue_datagram(ec_master_t *, ec_datagram_t *); |
341 void ec_master_queue_datagram(ec_master_t *, ec_datagram_t *); |
326 void ec_master_queue_datagram_ext(ec_master_t *, ec_datagram_t *); |
342 void ec_master_queue_datagram_ext(ec_master_t *, ec_datagram_t *); |
327 void ec_master_queue_external_datagram(ec_master_t *, ec_datagram_t *); |
|
328 void ec_master_inject_external_datagrams(ec_master_t *); |
|
329 |
343 |
330 // misc. |
344 // misc. |
331 void ec_master_set_send_interval(ec_master_t *, unsigned int); |
345 void ec_master_set_send_interval(ec_master_t *, unsigned int); |
332 void ec_master_attach_slave_configs(ec_master_t *); |
346 void ec_master_attach_slave_configs(ec_master_t *); |
333 ec_slave_t *ec_master_find_slave(ec_master_t *, uint16_t, uint16_t); |
347 ec_slave_t *ec_master_find_slave(ec_master_t *, uint16_t, uint16_t); |