equal
deleted
inserted
replaced
16 #include <linux/delay.h> |
16 #include <linux/delay.h> |
17 |
17 |
18 #include "ec_device.h" |
18 #include "ec_device.h" |
19 #include "ec_dbg.h" |
19 #include "ec_dbg.h" |
20 |
20 |
21 extern irqreturn_t rtl8139_interrupt(int, void *, struct pt_regs *); |
|
22 extern int rtl8139_poll(struct net_device *, int *); |
|
23 |
|
24 /***************************************************************/ |
21 /***************************************************************/ |
25 |
22 |
26 /** |
23 /** |
27 EtherCAT-Geräte-Konstuktor. |
24 EtherCAT-Geräte-Konstuktor. |
28 |
25 |
42 ecd->tx_intr_cnt = 0; |
39 ecd->tx_intr_cnt = 0; |
43 ecd->rx_intr_cnt = 0; |
40 ecd->rx_intr_cnt = 0; |
44 ecd->intr_cnt = 0; |
41 ecd->intr_cnt = 0; |
45 ecd->state = ECAT_DS_READY; |
42 ecd->state = ECAT_DS_READY; |
46 ecd->rx_data_length = 0; |
43 ecd->rx_data_length = 0; |
47 ecd->lock = NULL; |
44 ecd->isr = NULL; |
48 } |
45 } |
49 |
46 |
50 /***************************************************************/ |
47 /***************************************************************/ |
51 |
48 |
52 /** |
49 /** |
291 @return Anzahl der kopierten Bytes bei Erfolg, sonst < 0 |
288 @return Anzahl der kopierten Bytes bei Erfolg, sonst < 0 |
292 */ |
289 */ |
293 |
290 |
294 void EtherCAT_device_call_isr(EtherCAT_device_t *ecd) |
291 void EtherCAT_device_call_isr(EtherCAT_device_t *ecd) |
295 { |
292 { |
296 int budget; |
293 if (ecd->isr) ecd->isr(0, ecd->dev, NULL); |
297 |
|
298 budget = 1; /* Einen Frame empfangen */ |
|
299 |
|
300 rtl8139_interrupt(0, ecd->dev, NULL); |
|
301 ecd->dev->quota = 1; |
|
302 rtl8139_poll(ecd->dev, &budget); |
|
303 |
|
304 /* HM |
|
305 if (budget != 0) |
|
306 { |
|
307 EC_DBG(KERN_ERR "EtherCAT: Warning - Budget is %d!\n", |
|
308 budget); |
|
309 } |
|
310 */ |
|
311 } |
294 } |
312 |
295 |
313 /***************************************************************/ |
296 /***************************************************************/ |
314 |
297 |
315 /** |
298 /** |
334 EC_DBG(KERN_DEBUG "Total Number of interrupts: %u\n", (unsigned) ecd->intr_cnt); |
317 EC_DBG(KERN_DEBUG "Total Number of interrupts: %u\n", (unsigned) ecd->intr_cnt); |
335 EC_DBG(KERN_DEBUG "Actual device state: %i\n", (int) ecd->state); |
318 EC_DBG(KERN_DEBUG "Actual device state: %i\n", (int) ecd->state); |
336 EC_DBG(KERN_DEBUG "Receive buffer: %X\n", (unsigned) ecd->rx_data); |
319 EC_DBG(KERN_DEBUG "Receive buffer: %X\n", (unsigned) ecd->rx_data); |
337 EC_DBG(KERN_DEBUG "Receive buffer fill state: %u/%u\n", |
320 EC_DBG(KERN_DEBUG "Receive buffer fill state: %u/%u\n", |
338 (unsigned) ecd->rx_data_length, ECAT_FRAME_BUFFER_SIZE); |
321 (unsigned) ecd->rx_data_length, ECAT_FRAME_BUFFER_SIZE); |
339 EC_DBG(KERN_DEBUG "Lock: %X\n", (unsigned) ecd->lock); |
|
340 } |
322 } |
341 else |
323 else |
342 { |
324 { |
343 EC_DBG(KERN_DEBUG "Device is NULL!\n"); |
325 EC_DBG(KERN_DEBUG "Device is NULL!\n"); |
344 } |
326 } |
351 EXPORT_SYMBOL(EtherCAT_device_open); |
333 EXPORT_SYMBOL(EtherCAT_device_open); |
352 EXPORT_SYMBOL(EtherCAT_device_close); |
334 EXPORT_SYMBOL(EtherCAT_device_close); |
353 EXPORT_SYMBOL(EtherCAT_device_clear); |
335 EXPORT_SYMBOL(EtherCAT_device_clear); |
354 EXPORT_SYMBOL(EtherCAT_device_debug); |
336 EXPORT_SYMBOL(EtherCAT_device_debug); |
355 |
337 |
|
338 /***************************************************************/ |