equal
deleted
inserted
replaced
63 #ifdef EC_HAVE_CYCLES |
63 #ifdef EC_HAVE_CYCLES |
64 |
64 |
65 /** Frame timeout in cycles. |
65 /** Frame timeout in cycles. |
66 */ |
66 */ |
67 static cycles_t timeout_cycles; |
67 static cycles_t timeout_cycles; |
68 static cycles_t sdo_injection_timeout_cycles; |
68 |
|
69 /** Timeout for external datagram injection [cycles]. |
|
70 */ |
|
71 static cycles_t ext_injection_timeout_cycles; |
|
72 |
69 #else |
73 #else |
70 |
74 |
71 /** Frame timeout in jiffies. |
75 /** Frame timeout in jiffies. |
72 */ |
76 */ |
73 static unsigned long timeout_jiffies; |
77 static unsigned long timeout_jiffies; |
74 static unsigned long sdo_injection_timeout_jiffies; |
78 |
|
79 /** Timeout for external datagram injection [jiffies]. |
|
80 */ |
|
81 static unsigned long ext_injection_timeout_jiffies; |
75 |
82 |
76 #endif |
83 #endif |
77 |
84 |
78 /*****************************************************************************/ |
85 /*****************************************************************************/ |
79 |
86 |
92 */ |
99 */ |
93 void ec_master_init_static(void) |
100 void ec_master_init_static(void) |
94 { |
101 { |
95 #ifdef EC_HAVE_CYCLES |
102 #ifdef EC_HAVE_CYCLES |
96 timeout_cycles = (cycles_t) EC_IO_TIMEOUT /* us */ * (cpu_khz / 1000); |
103 timeout_cycles = (cycles_t) EC_IO_TIMEOUT /* us */ * (cpu_khz / 1000); |
97 sdo_injection_timeout_cycles = (cycles_t) EC_SDO_INJECTION_TIMEOUT /* us */ * (cpu_khz / 1000); |
104 ext_injection_timeout_cycles = (cycles_t) EC_SDO_INJECTION_TIMEOUT /* us */ * (cpu_khz / 1000); |
98 #else |
105 #else |
99 // one jiffy may always elapse between time measurement |
106 // one jiffy may always elapse between time measurement |
100 timeout_jiffies = max(EC_IO_TIMEOUT * HZ / 1000000, 1); |
107 timeout_jiffies = max(EC_IO_TIMEOUT * HZ / 1000000, 1); |
101 sdo_injection_timeout_jiffies = max(EC_SDO_INJECTION_TIMEOUT * HZ / 1000000, 1); |
108 ext_injection_timeout_jiffies = max(EC_SDO_INJECTION_TIMEOUT * HZ / 1000000, 1); |
102 #endif |
109 #endif |
103 } |
110 } |
104 |
111 |
105 /*****************************************************************************/ |
112 /*****************************************************************************/ |
106 |
113 |
751 } else { |
758 } else { |
752 #ifdef EC_HAVE_CYCLES |
759 #ifdef EC_HAVE_CYCLES |
753 cycles_t cycles_now = get_cycles(); |
760 cycles_t cycles_now = get_cycles(); |
754 |
761 |
755 if (cycles_now - datagram->cycles_sent |
762 if (cycles_now - datagram->cycles_sent |
756 > sdo_injection_timeout_cycles) |
763 > ext_injection_timeout_cycles) |
757 #else |
764 #else |
758 if (jiffies - datagram->jiffies_sent |
765 if (jiffies - datagram->jiffies_sent |
759 > sdo_injection_timeout_jiffies) |
766 > ext_injection_timeout_jiffies) |
760 #endif |
767 #endif |
761 { |
768 { |
762 unsigned int time_us; |
769 unsigned int time_us; |
763 |
770 |
764 list_del_init(&datagram->queue); |
771 list_del_init(&datagram->queue); |