Skip to content

Commit 00dbfba

Browse files
committed
update: remove unused code
1 parent 8b9e325 commit 00dbfba

File tree

4 files changed

+13
-38
lines changed

4 files changed

+13
-38
lines changed

include/ec_slave.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ typedef struct ec_slave {
8282
uint8_t base_fmmu_bit_operation; /**< FMMU bit operation is supported. */
8383
uint8_t base_dc_supported; /**< Distributed clocks are supported. */
8484
ec_slave_dc_range_t base_dc_range; /**< DC range. */
85-
uint8_t has_dc_system_time; /**< The slave supports the DC system time register. Otherwise it can only be used for delay measurement. */
8685
uint32_t transmission_delay; /**< DC system time transmission delay (offset from reference clock). */
8786

8887
uint32_t logical_start_address;

src/ec_cmd.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -205,18 +205,14 @@ static void ec_cmd_show_slave_detail(ec_master_t *master, uint32_t slave_idx)
205205
EC_LOG_RAW(" Distributed clocks: ");
206206

207207
if (slave_data.base_dc_supported) {
208-
if (slave_data.has_dc_system_time) {
209-
EC_LOG_RAW("yes, ");
210-
if (slave_data.base_dc_range) {
211-
EC_LOG_RAW("64 bit\n");
212-
} else {
213-
EC_LOG_RAW("32 bit\n");
214-
}
215-
EC_LOG_RAW(" DC system time transmission delay: %d ns\n",
216-
slave_data.transmission_delay);
208+
EC_LOG_RAW("yes, ");
209+
if (slave_data.base_dc_range) {
210+
EC_LOG_RAW("64 bit\n");
217211
} else {
218-
EC_LOG_RAW("yes, delay measurement only\n");
212+
EC_LOG_RAW("32 bit\n");
219213
}
214+
EC_LOG_RAW(" DC system time transmission delay: %d ns\n",
215+
slave_data.transmission_delay);
220216
} else {
221217
EC_LOG_RAW("no\n");
222218
}

src/ec_master.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@ EC_FAST_CODE_SECTION static void ec_master_send_datagrams(ec_master_t *master, u
4545
unsigned int datagram_count, more_datagrams_waiting;
4646
ec_dlist_t sent_datagrams;
4747

48-
#ifdef CONFIG_EC_CAL_TX_TIME
49-
uint64_t cycles_start = jiffies;
50-
#endif
5148
datagram_count = 0;
5249
ec_dlist_init(&sent_datagrams);
5350

@@ -138,10 +135,6 @@ EC_FAST_CODE_SECTION static void ec_master_send_datagrams(ec_master_t *master, u
138135
datagram_count++;
139136
}
140137
} while (more_datagrams_waiting);
141-
142-
#ifdef CONFIG_EC_CAL_TX_TIME
143-
EC_LOG_INFO("Sent %u datagrams in %uus.\n", datagram_count, (unsigned int)(jiffies - cycles_start));
144-
#endif
145138
}
146139

147140
EC_FAST_CODE_SECTION void ec_master_receive_datagrams(ec_master_t *master,
@@ -155,7 +148,6 @@ EC_FAST_CODE_SECTION void ec_master_receive_datagrams(ec_master_t *master,
155148
const uint8_t *cur_data;
156149
uint32_t datagram_count;
157150
ec_datagram_t *datagram;
158-
uint64_t start_time;
159151

160152
if (size < EC_FRAME_HEADER_SIZE) {
161153
EC_LOG_ERR("Corrupted frame received on %s (size %u < %u byte)\n",
@@ -177,8 +169,6 @@ EC_FAST_CODE_SECTION void ec_master_receive_datagrams(ec_master_t *master,
177169
return;
178170
}
179171

180-
start_time = jiffies;
181-
182172
datagram_count = 0;
183173
cmd_follows = 1;
184174
while (cmd_follows) {
@@ -239,7 +229,7 @@ EC_FAST_CODE_SECTION void ec_master_receive_datagrams(ec_master_t *master,
239229

240230
// dequeue the received datagram
241231
datagram->state = EC_DATAGRAM_RECEIVED;
242-
datagram->jiffies_received = jiffies - start_time;
232+
datagram->jiffies_received = jiffies;
243233
ec_master_unqueue_datagram(master, datagram);
244234

245235
datagram_count++;
@@ -833,4 +823,4 @@ EC_FAST_CODE_SECTION static void ec_master_period_process(void *arg)
833823
}
834824

835825
master->interval++;
836-
}
826+
}

src/ec_slave.c

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ static int ec_slave_config_dc_systime_and_delay(ec_slave_t *slave)
432432

433433
datagram = &slave->master->main_datagram;
434434

435-
if (slave->base_dc_supported && slave->has_dc_system_time) {
435+
if (slave->base_dc_supported) {
436436
ec_datagram_fprd(datagram, slave->station_address, ESCREG_OF(ESCREG->SYS_TIME), 24);
437437
datagram->netdev_idx = slave->netdev_idx;
438438
ret = ec_master_queue_ext_datagram(slave->master, datagram, true, true);
@@ -737,9 +737,7 @@ static int ec_slave_config(ec_slave_t *slave)
737737
}
738738

739739
if (slave->config && slave->config->dc_assign_activate) {
740-
if (!slave->base_dc_supported) {
741-
EC_SLAVE_LOG_WRN("Slave %u does not support DC, but DC is activated in master config\n", slave->index);
742-
}
740+
EC_ASSERT_MSG(slave->base_dc_supported, "Slave %u does not support DC", slave->index);
743741

744742
ec_slave_config_dc_systime_and_delay(slave);
745743

@@ -891,7 +889,7 @@ static void ec_master_find_dc_ref_clock(ec_master_t *master)
891889
for (slave = master->slaves;
892890
slave < master->slaves + master->slave_count;
893891
slave++) {
894-
if (slave->base_dc_supported && slave->has_dc_system_time) {
892+
if (slave->base_dc_supported) {
895893
ref = slave;
896894
break;
897895
}
@@ -1173,12 +1171,12 @@ void ec_slaves_scanning(ec_master_t *master)
11731171

11741172
slave->base_fmmu_count = EC_READ_U8(datagram->data + 4);
11751173
EC_ASSERT_MSG(slave->base_fmmu_count <= EC_MAX_FMMUS,
1176-
"Slave %u FMMU count %u is overflow\n",
1174+
"Slave %u FMMU count %u is overflow",
11771175
slave->index, slave->base_fmmu_count);
11781176

11791177
slave->base_sync_count = EC_READ_U8(datagram->data + 5);
11801178
EC_ASSERT_MSG(slave->base_sync_count <= EC_MAX_SYNC_MANAGERS,
1181-
"Slave %u sync managers count %u is overflow\n",
1179+
"Slave %u sync managers count %u is overflow",
11821180
slave->index, slave->base_fmmu_count);
11831181

11841182
uint8_t data = EC_READ_U8(datagram->data + 7);
@@ -1203,14 +1201,6 @@ void ec_slaves_scanning(ec_master_t *master)
12031201
goto mutex_unlock;
12041202
}
12051203

1206-
if (datagram->working_counter == 1) {
1207-
slave->has_dc_system_time = 1;
1208-
EC_SLAVE_LOG_DBG("Slave has the System Time register\n");
1209-
} else {
1210-
slave->has_dc_system_time = 0;
1211-
EC_SLAVE_LOG_DBG("Slave has no System Time register; delay measurement only\n");
1212-
}
1213-
12141204
// Read DC port receive times
12151205
ec_datagram_fprd(datagram, slave->station_address, ESCREG_OF(ESCREG->RCV_TIME[0]), 16);
12161206
ec_datagram_zero(datagram);

0 commit comments

Comments
 (0)