31 #include "msr_param.h" |
31 #include "msr_param.h" |
32 #include "msr_jitter.h" |
32 #include "msr_jitter.h" |
33 |
33 |
34 // EtherCAT |
34 // EtherCAT |
35 #include "../include/EtherCAT_rt.h" |
35 #include "../include/EtherCAT_rt.h" |
36 #include "../libec/libec.h" |
36 #include "../include/EtherCAT_si.h" |
37 |
37 |
38 // Defines/Makros |
38 // Defines/Makros |
39 #define TSC2US(T1, T2) ((T2 - T1) * 1000UL / cpu_khz) |
39 #define TSC2US(T1, T2) ((T2 - T1) * 1000UL / cpu_khz) |
40 #define HZREDUCTION (MSR_ABTASTFREQUENZ / HZ) |
40 #define HZREDUCTION (MSR_ABTASTFREQUENZ / HZ) |
41 |
41 |
84 if (counter) { |
84 if (counter) { |
85 counter--; |
85 counter--; |
86 } |
86 } |
87 else { |
87 else { |
88 // "Star Trek"-Effekte |
88 // "Star Trek"-Effekte |
89 LEC_write_EL20XX(s_out1, 0, jiffies & 1); |
89 EC_WRITE_EL20XX(s_out1, 0, jiffies & 1); |
90 LEC_write_EL20XX(s_out1, 1, (jiffies >> 1) & 1); |
90 EC_WRITE_EL20XX(s_out1, 1, (jiffies >> 1) & 1); |
91 LEC_write_EL20XX(s_out1, 2, (jiffies >> 2) & 1); |
91 EC_WRITE_EL20XX(s_out1, 2, (jiffies >> 2) & 1); |
92 LEC_write_EL20XX(s_out1, 3, (jiffies >> 3) & 1); |
92 EC_WRITE_EL20XX(s_out1, 3, (jiffies >> 3) & 1); |
93 LEC_write_EL20XX(s_out2, 0, (jiffies >> 4) & 1); |
93 EC_WRITE_EL20XX(s_out2, 0, (jiffies >> 4) & 1); |
94 LEC_write_EL20XX(s_out2, 1, (jiffies >> 3) & 1); |
94 EC_WRITE_EL20XX(s_out2, 1, (jiffies >> 3) & 1); |
95 LEC_write_EL20XX(s_out2, 2, (jiffies >> 2) & 1); |
95 EC_WRITE_EL20XX(s_out2, 2, (jiffies >> 2) & 1); |
96 LEC_write_EL20XX(s_out2, 3, (jiffies >> 6) & 1); |
96 EC_WRITE_EL20XX(s_out2, 3, (jiffies >> 6) & 1); |
97 LEC_write_EL20XX(s_out3, 0, (jiffies >> 7) & 1); |
97 EC_WRITE_EL20XX(s_out3, 0, (jiffies >> 7) & 1); |
98 LEC_write_EL20XX(s_out3, 1, (jiffies >> 2) & 1); |
98 EC_WRITE_EL20XX(s_out3, 1, (jiffies >> 2) & 1); |
99 LEC_write_EL20XX(s_out3, 2, (jiffies >> 8) & 1); |
99 EC_WRITE_EL20XX(s_out3, 2, (jiffies >> 8) & 1); |
100 |
100 |
101 counter = MSR_ABTASTFREQUENZ / 4; |
101 counter = MSR_ABTASTFREQUENZ / 4; |
102 } |
102 } |
103 |
103 |
104 LEC_write_EL20XX(s_out3, 3, LEC_read_EL31XX(s_in1, 0) < 0); |
104 EC_WRITE_EL20XX(s_out3, 3, EC_READ_EL31XX(s_in1, 0) < 0); |
105 |
105 |
106 // Prozessdaten lesen und schreiben |
106 // Prozessdaten lesen und schreiben |
107 EtherCAT_rt_domain_xio(master, 0, 40); |
107 EtherCAT_rt_domain_xio(master, 0, 40); |
108 } |
108 } |
109 |
109 |