Skip to content

Commit 78713a4

Browse files
committed
Clean up GD32 Ethernet timing and logs
Update the GD32 PHY code to use the current timer API (`gd32::Millis()` from `gd32_timers.h`), and tighten Ethernet debug output by fixing the timestamp wait format specifiers and switching the IGMP drop message to the interface-specific debug macro.
1 parent c07110f commit 78713a4

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

lib-network/src/emac/gd32/emac_eth.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ template <bool T> static void PtpFrameTransmit(uint32_t length) {
184184
timeout++;
185185
} while ((0 == tdes0_ttmss_flag) && (timeout < UINT32_MAX));
186186

187-
EMAC_DEBUG_PRINTF("timeout=%x %d", timeout, (dma_current_txdesc->status & ENET_TDES0_TTMSS));
187+
EMAC_DEBUG_PRINTF("timeout=%x %u", static_cast<unsigned>(timeout), static_cast<unsigned>(dma_current_txdesc->status & ENET_TDES0_TTMSS));
188188

189189
dma_current_txdesc->status &= ~ENET_TDES0_TTMSS; ///< Clear timestamp flag
190190

lib-network/src/emac/gd32/emac_phy.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
#include "emac/emac_phy.h"
2929
#include "emac/mmi.h"
30-
#include "gd32_millis.h"
30+
#include "gd32_timers.h"
3131
#include "emac/emac_debug.h"
3232
#include "gd32.h" // IWYU pragma: keep
3333

@@ -148,10 +148,10 @@ bool Config(uint16_t address) {
148148
* IEEE spec.
149149
*/
150150

151-
const auto kMillis = millis();
151+
const auto kMillis = gd32::Millis();
152152
uint16_t value;
153153

154-
while (millis() - kMillis < 500U) {
154+
while (gd32::Millis() - kMillis < 500U) {
155155
if (!phy::Read(address, emac::mmi::REG_BMCR, value)) {
156156
DEBUG_PUTS("PHY status read failed");
157157
EMAC_PHY_DEBUG_EXIT();

lib-network/src/iface/ethernet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ void EthernetInput(const uint8_t* buffer, [[maybe_unused]] uint32_t length) {
6666
if ((kEther->dst[0] == network::ethernet::kIP4MulticastAddr0) && (kEther->dst[1] == network::ethernet::kIP4MulticastAddr1) && (kEther->dst[2] == network::ethernet::kIP4MulticastAddr2)) {
6767
if (!network::igmp::LookupGroup(network::MemcpyIp(kIp4->ip4.dst))) {
6868
emac::eth::FreePkt();
69-
DEBUG_PUTS("IGMP not for us");
69+
NETWORK_IFACE_DEBUG_PUTS("IGMP not for us");
7070
return;
7171
}
7272
}

0 commit comments

Comments
 (0)