57 * |
58 * |
58 * \param slave EtherCAT slave |
59 * \param slave EtherCAT slave |
59 * \param fmt format string (like in printf()) |
60 * \param fmt format string (like in printf()) |
60 * \param args arguments (optional) |
61 * \param args arguments (optional) |
61 */ |
62 */ |
|
63 #ifdef USE_TRACE_PRINTK |
|
64 #define EC_SLAVE_INFO(slave, fmt, args...) \ |
|
65 do { \ |
|
66 __trace_printk(_THIS_IP_,"EtherCAT %u-%u: " fmt, slave->master->index, \ |
|
67 slave->ring_position, ##args); \ |
|
68 printk(KERN_INFO "EtherCAT %u-%u: " fmt, slave->master->index, \ |
|
69 slave->ring_position, ##args); \ |
|
70 } while (0) |
|
71 #else |
62 #define EC_SLAVE_INFO(slave, fmt, args...) \ |
72 #define EC_SLAVE_INFO(slave, fmt, args...) \ |
63 printk(KERN_INFO "EtherCAT %u-%u: " fmt, slave->master->index, \ |
73 printk(KERN_INFO "EtherCAT %u-%u: " fmt, slave->master->index, \ |
64 slave->ring_position, ##args) |
74 slave->ring_position, ##args) |
|
75 #endif |
65 |
76 |
66 /** Convenience macro for printing slave-specific errors to syslog. |
77 /** Convenience macro for printing slave-specific errors to syslog. |
67 * |
78 * |
68 * This will print the message in \a fmt with a prefixed |
79 * This will print the message in \a fmt with a prefixed |
69 * "EtherCAT <INDEX>-<POSITION>: ", where INDEX is the master index and |
80 * "EtherCAT <INDEX>-<POSITION>: ", where INDEX is the master index and |
71 * |
82 * |
72 * \param slave EtherCAT slave |
83 * \param slave EtherCAT slave |
73 * \param fmt format string (like in printf()) |
84 * \param fmt format string (like in printf()) |
74 * \param args arguments (optional) |
85 * \param args arguments (optional) |
75 */ |
86 */ |
|
87 #ifdef USE_TRACE_PRINTK |
|
88 #define EC_SLAVE_ERR(slave, fmt, args...) \ |
|
89 do { \ |
|
90 __trace_printk(_THIS_IP_,"EtherCAT ERROR %u-%u: " fmt, slave->master->index, \ |
|
91 slave->ring_position, ##args); \ |
|
92 printk(KERN_ERR "EtherCAT ERROR %u-%u: " fmt, slave->master->index, \ |
|
93 slave->ring_position, ##args); \ |
|
94 } while (0) |
|
95 #else |
76 #define EC_SLAVE_ERR(slave, fmt, args...) \ |
96 #define EC_SLAVE_ERR(slave, fmt, args...) \ |
77 printk(KERN_ERR "EtherCAT ERROR %u-%u: " fmt, slave->master->index, \ |
97 printk(KERN_ERR "EtherCAT ERROR %u-%u: " fmt, slave->master->index, \ |
78 slave->ring_position, ##args) |
98 slave->ring_position, ##args) |
|
99 #endif |
79 |
100 |
80 /** Convenience macro for printing slave-specific warnings to syslog. |
101 /** Convenience macro for printing slave-specific warnings to syslog. |
81 * |
102 * |
82 * This will print the message in \a fmt with a prefixed |
103 * This will print the message in \a fmt with a prefixed |
83 * "EtherCAT <INDEX>-<POSITION>: ", where INDEX is the master index and |
104 * "EtherCAT <INDEX>-<POSITION>: ", where INDEX is the master index and |
85 * |
106 * |
86 * \param slave EtherCAT slave |
107 * \param slave EtherCAT slave |
87 * \param fmt format string (like in printf()) |
108 * \param fmt format string (like in printf()) |
88 * \param args arguments (optional) |
109 * \param args arguments (optional) |
89 */ |
110 */ |
|
111 #ifdef USE_TRACE_PRINTK |
|
112 #define EC_SLAVE_WARN(slave, fmt, args...) \ |
|
113 do { \ |
|
114 __trace_printk(_THIS_IP_,"EtherCAT WARNING %u-%u: " fmt, \ |
|
115 slave->master->index, slave->ring_position, ##args); \ |
|
116 printk(KERN_WARNING "EtherCAT WARNING %u-%u: " fmt, \ |
|
117 slave->master->index, slave->ring_position, ##args); \ |
|
118 } while (0) |
|
119 #else |
90 #define EC_SLAVE_WARN(slave, fmt, args...) \ |
120 #define EC_SLAVE_WARN(slave, fmt, args...) \ |
91 printk(KERN_WARNING "EtherCAT WARNING %u-%u: " fmt, \ |
121 printk(KERN_WARNING "EtherCAT WARNING %u-%u: " fmt, \ |
92 slave->master->index, slave->ring_position, ##args) |
122 slave->master->index, slave->ring_position, ##args) |
|
123 #endif |
93 |
124 |
94 /** Convenience macro for printing slave-specific debug messages to syslog. |
125 /** Convenience macro for printing slave-specific debug messages to syslog. |
95 * |
126 * |
96 * This will print the message in \a fmt with a prefixed |
127 * This will print the message in \a fmt with a prefixed |
97 * "EtherCAT <INDEX>-<POSITION>: ", where INDEX is the master index and |
128 * "EtherCAT <INDEX>-<POSITION>: ", where INDEX is the master index and |
99 * |
130 * |
100 * \param slave EtherCAT slave |
131 * \param slave EtherCAT slave |
101 * \param fmt format string (like in printf()) |
132 * \param fmt format string (like in printf()) |
102 * \param args arguments (optional) |
133 * \param args arguments (optional) |
103 */ |
134 */ |
|
135 #ifdef USE_TRACE_PRINTK |
104 #define EC_SLAVE_DBG(slave, level, fmt, args...) \ |
136 #define EC_SLAVE_DBG(slave, level, fmt, args...) \ |
105 do { \ |
137 do { \ |
|
138 __trace_printk(_THIS_IP_,"EtherCAT DEBUG%u %u-%u: " fmt, \ |
|
139 level,slave->master->index, slave->ring_position, ##args); \ |
106 if (slave->master->debug_level >= level) { \ |
140 if (slave->master->debug_level >= level) { \ |
107 printk(KERN_DEBUG "EtherCAT DEBUG %u-%u: " fmt, \ |
141 printk(KERN_DEBUG "EtherCAT DEBUG %u-%u: " fmt, \ |
108 slave->master->index, slave->ring_position, ##args); \ |
142 slave->master->index, slave->ring_position, ##args); \ |
109 } \ |
143 } \ |
110 } while (0) |
144 } while (0) |
|
145 #else |
|
146 #define EC_SLAVE_DBG(slave, level, fmt, args...) \ |
|
147 do { \ |
|
148 if (slave->master->debug_level >= level) { \ |
|
149 printk(KERN_DEBUG "EtherCAT DEBUG %u-%u: " fmt, \ |
|
150 slave->master->index, slave->ring_position, ##args); \ |
|
151 } \ |
|
152 } while (0) |
|
153 #endif |
111 |
154 |
112 /*****************************************************************************/ |
155 /*****************************************************************************/ |
113 |
156 |
114 /** Slave port. |
157 /** Slave port. |
115 */ |
158 */ |
230 space. */ |
273 space. */ |
231 struct list_head soe_requests; /**< FoE write requests. */ |
274 struct list_head soe_requests; /**< FoE write requests. */ |
232 wait_queue_head_t soe_queue; /**< Wait queue for SoE requests from user |
275 wait_queue_head_t soe_queue; /**< Wait queue for SoE requests from user |
233 space. */ |
276 space. */ |
234 ec_fsm_slave_t fsm; /**< Slave state machine. */ |
277 ec_fsm_slave_t fsm; /**< Slave state machine. */ |
235 ec_datagram_t fsm_datagram; /**< Datagram used for state machines. */ |
278 ec_datagram_t datagram; /** Datagram used for data transfers */ |
|
279 ec_mailbox_t mbox; /**< Mailbox used for data transfers. */ |
236 }; |
280 }; |
237 |
281 |
238 /*****************************************************************************/ |
282 /*****************************************************************************/ |
239 |
283 |
240 // slave construction/destruction |
284 // slave construction/destruction |